brem13 Posted March 29, 2009 Share Posted March 29, 2009 hey, does anyone know what is wrong with this line? i use the EXACT same line in another page and i dont have a problem error Could not insert data because 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 'values ('NULL', 'breminem', 'RE:Â test123', 'rewy', 'New', '2009-03-29 16:41:39'' at line 1 my database has 7 fields btw $insert = mysql_query("insert into $user values ('NULL', '$username', '$sub', '$message', 'New', '$dt2', '$dt2')") or die("Could not insert data because ".mysql_error()); Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted March 29, 2009 Share Posted March 29, 2009 Don't put quotes around NULL when you want auto_increment to work... 'NULL' is a string and mysql will treat it as such. Quote Link to comment Share on other sites More sharing options...
brem13 Posted March 29, 2009 Author Share Posted March 29, 2009 k, same error just no quotes around null Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted March 29, 2009 Share Posted March 29, 2009 $user is probably empty. How about forming your query in a variable so that you can echo it to see what is in it. Quote Link to comment Share on other sites More sharing options...
brem13 Posted March 29, 2009 Author Share Posted March 29, 2009 ok, this is the line that should be posting the $user but its not posting it from the previous page, its blank <input type="hidden" name="user" value="<?php echo $user; ?>"> Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted March 29, 2009 Share Posted March 29, 2009 When you do a "view source" of the form in your browser, is the value present? Quote Link to comment Share on other sites More sharing options...
brem13 Posted March 29, 2009 Author Share Posted March 29, 2009 yes Quote Link to comment Share on other sites More sharing options...
brem13 Posted March 29, 2009 Author Share Posted March 29, 2009 ok, i had a couple variables wrong in a different page, thanks guys, u got me on the right track 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.