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

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.