I’m trying to display ul>li list using PHP while loop and MYSQL.
My database ‘company’ has table ‘news’ with 2 columns ‘ id & content’.
The while loop works correctly it is returning two 'li' = as there are two rows in the table.
But, instate of data from the table something like this $indx." - ".$ID." ".$CONTENT." is inserted in each ‘li’.
My while loop:
$readNews_SQLselect = "SELECT ";
$readNews_SQLselect .= "id, content "; // rows names
$readNews_SQLselect .= "FROM ";
$readNews_SQLselect .= "news "; // table name
$readNews_SQLselect_Query = mysql_query($readNews_SQLselect);
$indx = 1;
while ($row = mysql_fetch_array($readNews_SQLselect_Query, MYSQL_ASSOC)) {
$ID = $row['id'];
$CONTENT = $row['content'];
echo '<li>$indx." - ".$ID." ".$CONTENT."</li>';
$indx++;
}
mysql_free_result($readNews_SQLselect_Query);
I’m 99% sure is the syntax issue with echo '<li>$indx." - ".$ID." ".$CONTENT."</li>';.
replace
with:
EDIT 1
or with: