Jump to content

MySQL / PHP problem, can someone help?


Viper76

Recommended Posts

I am working on a page that will limit how many items are given to me by the database at one time, here is the line of code that I am for some reason having trouble with:

$result = mysql_query("SELECT spic, name FROM $tb1 LIMIT $at, 1 WHERE cat1 = '$cat' OR cat2 = '$cat' OR cat3 = '$cat'",$db) or die(mysql_error());

And this is the error I am getting:

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 'WHERE cat1 = '116' OR cat2 = '116' OR cat3 = '116'' at line 1

If I take out the LIMIT portion, it works fine, so I assume it has something to di with how, or where I added it.  If someone could help, that would be just great, thanks for your time!
Link to comment
Share on other sites

instead of running it as a query I changed it over to an echo, to see what was printing on the screen and found my problem, I was not properly defining $at before the string.  Got it all fixed now, thanks though guys  ;D
Link to comment
Share on other sites

Guest
This topic is now 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.