Jump to content

Insert Error


lilman

Recommended Posts

Here is my code:

[code]
$insert = "INSERT INTO hotornot (username,path,gender,score,num_of_votes,sum_of_score) VALUES ('$username','$path','$gender','0','0','0')";

Line # 78: $result = mysql_query($insert) or die("Error ". mysql_error. " with query ". $insert);
[/code]

Error:

[quote]Notice: Use of undefined constant mysql_error - assumed 'mysql_error' in /home2/usname/public_html/site/hotornot/insert.php on line 78
Error mysql_error with query INSERT INTO hotornot (username,path,gender,score,num_of_votes,sum_of_score) VALUES ('lilman','lilman.jpg','Male','0','0','0')[/quote]

I don't see anything wrong with what I got. The SQL Insert command seems fine, the variables all have values, I don't get... what is it that I am missing?
Link to comment
https://forums.phpfreaks.com/topic/27806-insert-error/
Share on other sites

Hi

you have set mysql_error here as a constant, mysql_error is a function returning a human readable error so should read as follows:

[code]
$result = mysql_query($insert) or die("Error " . mysql_error() . " with query " . $insert);
[/code]
Link to comment
https://forums.phpfreaks.com/topic/27806-insert-error/#findComment-127221
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.