lesolemph Posted September 8, 2010 Share Posted September 8, 2010 trying to select from table and i get this error.. "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'table' at line 1" pliz help <?php $con=@mysql_connect('localhost','root',''); if(!$con) { die('Could not connect:'.mysql_error()); } mysql_select_db("database",$con)or die('Could not find db:'.mysql_error()); $sql = @mysql_query("SELECT * FROM table ") or die ( mysql_error()); $row = mysql_fetch_array($sql); echo $row['info']; ?> my database name = "database" table = "table" info information my table has only one field "info" with only one row... please help Link to comment https://forums.phpfreaks.com/topic/212875-sql-syntax-error/ Share on other sites More sharing options...
AbraCadaver Posted September 8, 2010 Share Posted September 8, 2010 http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html Link to comment https://forums.phpfreaks.com/topic/212875-sql-syntax-error/#findComment-1108751 Share on other sites More sharing options...
lesolemph Posted September 8, 2010 Author Share Posted September 8, 2010 thnx 4 th reply bt i jst dnt get it... Link to comment https://forums.phpfreaks.com/topic/212875-sql-syntax-error/#findComment-1108757 Share on other sites More sharing options...
AbraCadaver Posted September 8, 2010 Share Posted September 8, 2010 table is a reserved word. Link to comment https://forums.phpfreaks.com/topic/212875-sql-syntax-error/#findComment-1108761 Share on other sites More sharing options...
lesolemph Posted September 8, 2010 Author Share Posted September 8, 2010 thanx man... silly me... its okay now.. thanks big tym... Link to comment https://forums.phpfreaks.com/topic/212875-sql-syntax-error/#findComment-1108765 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.