Jump to content

[SOLVED] Query Not Running


RAH

Recommended Posts

Hello,

 

The SQL query in the following piece of code works fine when ran via phpMyAdmin however seems to have no effect when ran via PHP as nothing is inserted:

 

unlink("thuploads/" . basename($thumb_link));

if(!empty($title) && !empty($descr) && !empty($md5) && file_exists("uploads/$md5.jpg") && file_exists("thuploads/$md5.png"))
{
	mysql_query("
	insert into 
		vhc_items	(id, cid, name, time, pic, description, link, hidden, filter, clicks, weekclicks, clickslog, pin, starttime, endtime)
values 	('2147483648', '1', '".addslashes($title)."', '1189875417'," . addslashes($md5) . ", '" . addslashes($descr) . "' ,'" . addslashes($md5) . "','0', '0', '0', '0', '4|0|0|0|0|0|0|1189983109', '0', '0', '0')
		");
}

}

 

Even if the "if" statements are commented out nothing happens.  No errors, nothing inserted.

 

Any ideas?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/70543-solved-query-not-running/
Share on other sites

Hi,

 

Roopurt18 just beat me to this, but I'll post anyway...

 

It's always worthwhile wrapping your calls to mysql_query in some error checking code - it makes debugging a lot quicker if you can get mysql to give you a hint to what's wrong. Try:

 

if (!mysql_query ("insert into ...."))
{
   echo mysql_error();
}

 

As a first stab though, I'd say you'd need single quotes before and after you call addslashes ($md5), as you have done with title and descr.

 

Hope this helps,

Darren.

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.