Jump to content

Something simple wrong in this SQL insert query?


dhcrusoe

Recommended Posts

Hey guys,

 

What on earth is going on here? I'm getting a MySQL insert error, even though this code worked earlier... I'm thinking I have an extra character in there somewhere, but for the life of me, can't see it  ??? 

foreach ($inf as $key => $value)
{
		if (!mysql_query("INSERT INTO data (votes,date,prog,progname) VALUES ('".$inf[$key]['votes']."',".$global_date.",'".$key."','".$inf[$key]['progname']."')"))
		{
		trigger_error("MySQL Error occured : ".mysql_error($con), E_USER_WARNING );
		}

 

Thanks for your helpful (eyes!)

 

--Dave

Yep... sorry, there is another }  down in the code, but that's not the issue here (see error, pasted)

 

oh! pasting it, I see -- time has no ' at the end, I think

 

 

 

Error Level : 512 | Desc : MySQL Error occured : 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 '06:56:16,'0','Vegan school lunch options')' at line 1 [ /home/plmlorg/public_html/ChangeAnalytics2/test2.php=>90]

 

 

 

I'm guessing you just missed it out, but the last curly bracket is missing.

 

Also is global_date and integer?

 

And can you post the exact error you get

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.