Jump to content

Nonsensical mySQL error...


Recommended Posts

I can't figure out what is going on here.

When I use this in my code:

 

$result = mysql_query("SELECT * FROM read")or die(mysql_error());
$number = mysql_numrows($result);

 

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 'read' at line 1

 

Because I couldn't find anything wrong I thought I'd check if there is actually a problem, so I changed the name of the table to 'list', like this:

 

$result = mysql_query("SELECT * FROM list")or die(mysql_error());
$number = mysql_numrows($result);

 

And it worked fine, I recieved no error message and the rest of the code output what I expected it to.

 

Any ideas what could be going wrong? I've checked the tables and they're fine (the list table is just a copy of the read table, so I don't see why it would be affecting the code.)

Link to comment
https://forums.phpfreaks.com/topic/206495-nonsensical-mysql-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.