Jump to content

What's wrong with my SQL query?


Username:

Recommended Posts

I can't seem to find anything wrong with it, but it keeps giving me 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 'desc,img,vid) values('1','3','img/1299254331.PNG','2')' at line 1

 

My query:

include('includes/connect.php');
mysql_query("INSERT INTO ".$c[1]." (seed,desc,img,vid) values('$seed','$desc','$final','$vid')") or die(mysql_error());

:confused:

 

EDIT:

Nevermind, -apparently- you can't have a row called desc, or it thinks it means descending sort.

Link to comment
https://forums.phpfreaks.com/topic/229587-whats-wrong-with-my-sql-query/
Share on other sites

that's not the best practice, you should assign your SQL string to a variable and then execute the mysql_query() against the variable.  try this:

$qry ="INSERT INTO ".$c[1]." (seed, desc, img, vid) values('$seed', '$desc', '$final', '$vid')"; 
mysql_query($qry) or die($qry.'<br>Failed to run due to the following error :<br>'.mysql_error());

and see how you get on.

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.