0

What is wrong with this php code?

$sql = mysql_query("select * from news where isActive = 1 and partnerid_fk = '$partnerid'");
$news = "";
while($row = mysql_fetch_assoc($sql)) {
    news .= "<li class='news-item'><a href='#'>" . $row['news'] . "</a></li>";
}

Error on the news append line:

Syntax error. 
2
  • 3
    no dollar sign in variable news in the loop Commented Jan 20, 2013 at 15:45
  • 1
    you forgot a $ in news Commented Jan 20, 2013 at 15:45

1 Answer 1

4

You forgot your dollar sign:

news .= 

should be

$news .= 
Sign up to request clarification or add additional context in comments.

1 Comment

I completely focused on the right part of the line :) thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.