Jump to content

mysql syntax error...


Patrick3002

Recommended Posts

This seems impossible to fix but i kno its probably going to be simple i just cannot figure it out to save my life.

 

My 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: 't even gotta wonder
I was voted number one rapper to drop 

 

My code:

$sql = "INSERT INTO `$table` VALUES ('$pc', '$pBy', '$email', '$lyric', '$song', '$artist', '$date','','')";
mysql_query($sql);

 

Now, i know the problem i just cannot solve it... Theres a problem when i enclose the $lyric var with ' and ' but, i've tried enclosing it with everything possible even \" but it just does not want to execute.

 

Any help on this problem would be greatly appreciated.

Link to comment
Share on other sites

The lyric var is:  FIELD:lyric  TYPE:blob  ATTRIBUTES:BINARY  NULL:No 

in phpmyadmin.

 

But its technically song lyrics so basic text and chars such as: ' " [ ] etc.

 

Thats what that var ($lyric) contains.

 

The $table var just contains the table name (Lyrics_01) thats all that var contains, the var that has a problem is $lyric.

$table="lyrics_01";

 

Heres the link if you can figure it out that way, click Add Lyric at the top.

 

http://patricks.kicks-ass.net/lyrics/

Link to comment
Share on other sites

$lyric = mysql_real_escape_string($lyric);

$sql = "INSERT INTO `$table` VALUES ('$pc', '$pBy', '$email', '$lyric', '$song', '$artist', '$date','','')";

mysql_query($sql);

 

Problem solved, thank you very much now i need to research mysql_real_escape_string to see exactly what that does so i understand whats going on, haha thanks alot man!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.