RAH Posted September 24, 2007 Share Posted September 24, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/70543-solved-query-not-running/ Share on other sites More sharing options...
roopurt18 Posted September 24, 2007 Share Posted September 24, 2007 Try tacking an or die(mysql_error()) onto the call to mysql_query. Quote Link to comment https://forums.phpfreaks.com/topic/70543-solved-query-not-running/#findComment-354428 Share on other sites More sharing options...
recklessgeneral Posted September 24, 2007 Share Posted September 24, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/70543-solved-query-not-running/#findComment-354431 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.