uramagget Posted June 4, 2007 Share Posted June 4, 2007 <? include "news.inc.php"; ?> <html> <head> <title>News</title> <basefont face="Verdana"> </head> <body> <? //Generate News $query = "SELECT id, title, timestamp FROM $table ORDER BY id ASC LIMIT 0, 5"; $result = mysql_query($query) or die ("mysql_error()); if (mysql_num_rows($result) > 0) { while($row = mysql_fetch_array($result)) { ?> <h2><? echo $row['title']; ?></h2> <p><? echo $row['content']; ?></p> <div align='right'> Posted by <? echo $row['author']; ?> </div> <? } } else { echo "no news"; } mysql_close(); ?> </body> </html> Returns: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/parahost/public_html/news.php on line 20 Quote Link to comment https://forums.phpfreaks.com/topic/54191-solved-php-error-cant-determine/ Share on other sites More sharing options...
otuatail Posted June 4, 2007 Share Posted June 4, 2007 Odd line 12 $query = "SELECT id, title, timestamp FROM $table ORDER BY id ASC LIMIT 0, 5"; where does $table come from? it is net declared on this page. Quote Link to comment https://forums.phpfreaks.com/topic/54191-solved-php-error-cant-determine/#findComment-267931 Share on other sites More sharing options...
trq Posted June 4, 2007 Share Posted June 4, 2007 $result = mysql_query($query) or die ("mysql_error()); Should be... $result = mysql_query($query) or die (mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/54191-solved-php-error-cant-determine/#findComment-267932 Share on other sites More sharing options...
uramagget Posted June 4, 2007 Author Share Posted June 4, 2007 Alright, it seems the mySQL error format WAS wrong. Thanks thorpe! Quote Link to comment https://forums.phpfreaks.com/topic/54191-solved-php-error-cant-determine/#findComment-267938 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.