New code error!

There is an error with the while on the 4th line of code below. It’s a syntax error saying that “unexpected T_LOGICAL_OR in /home/a3362820/public_html/assignment/index.php”

<?php

echo “<h1>Blog</h1><hr>”;

require_once(‘includes/config.php’);

$queryget = mysql_query(“SELECT * FROM blogEntries ORDER BY id DESC”);

while ($row = mysql_fetch_assoc($queryget)) or die (mysql_error())
{
$id = $row[‘id’];
$name = $row[‘name’];
$message = $row[‘message’];
$date = $row[‘date’];
$time = $row[‘time’];
}

echo “<hr>”;

echo "
<form action=;index.php’ method=‘POST’>
<table width=‘100%’>
<tr>
<td width=‘18%’ valign=‘top’>
Your name:
</td>
<td>
<input type=‘text’ name=‘name’ maxlength=‘25’>
</td>
</tr>

   &lt;tr&gt;
       &lt;td valign='top'&gt;
       Your message:
       &lt;/td&gt;
       &lt;td&gt;
       &lt;textarea cols='20' rows='2' name='message maxlength='250'&gt;
       &lt;p&gt;
       &lt;input type='submit' name='submit' value='Post'&gt;
       &lt;/td&gt;
   &lt;/tr&gt;

</table>
</form>

";
?>

Any help would be appreciated.

Please use the appropriate tags when you post code.

And why do you use ‘or die’ here?

while ($row = mysql_fetch_assoc($queryget)) or die (mysql_error())

Use it on the mysql_query command instead.

This line is not correct syntax:


while ($row = mysql_fetch_assoc($queryget)) or die (mysql_error())
{

You need to remove the or die (mysql_error())" bit.

Don’t add any code between the closing ‘)’ of the while condition and the ‘{’.
Rewriting the while sentence …


while ($row = mysql_fetch_assoc($queryget) or die(mysql_error()))

To be honest you should not be using “or die()” in the first place.
Implement proper error handling from the beginning.