nightcrawler Posted April 13, 2007 Share Posted April 13, 2007 $q = "INSERT INTO downloads (sub, title, name, email, link, date, description, pic) VALUES ('$c', '$t', '$n', '$e', '$l', 'NOW()', '$d', 'NULL')"; $addinfo = mysql_query($q); Does that look right? I don't have many resources for php and mysql. Quote Link to comment Share on other sites More sharing options...
btherl Posted April 13, 2007 Share Posted April 13, 2007 Looks ok, except now() and null should not be quoted. Try "echo $q" also so you can see the final query. And it's good to have a check like this: $addinfo = mysql_query($q) or die("Error in $q: " . mysql_error()); Quote Link to comment Share on other sites More sharing options...
nightcrawler Posted April 13, 2007 Author Share Posted April 13, 2007 lol, thanks. I did have a check, but it said: ... or die("This sucks"); So I thought I'd leave it out. I'll try removing the quotes. Thanks. Quote Link to comment Share on other sites More sharing options...
btherl Posted April 13, 2007 Share Posted April 13, 2007 Try the check I posted.. it'll tell you not just that the query failed, but also the reason why it failed. Plus it will show you the query, which will show you if one of the input variables was not what you expected it to be. It can save a lot of debugging time Quote Link to comment Share on other sites More sharing options...
nightcrawler Posted April 13, 2007 Author Share Posted April 13, 2007 The syntax fixed it quick. I've seen that mysql_error() used often for dies in error checking. Thanks for the tip. Quote Link to comment 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.