xcoderx Posted July 29, 2010 Share Posted July 29, 2010 whats wrong in here for i get query failed everytime i submit the form? //Create INSERT query $qry = "INSERT INTO class_members (user_name, passwrd, f_name, l_name, email, gender, date) VALUES('$user_name','".md5($_POST['password'])."','$f_name','$l_name','$email', '$gender','gmdate($date)',)"; $result = @mysql_query($qry); //Check whether the query was successful or not if($result) { header("location: register-success.php"); exit(); }else { die("Query failed"); } Quote Link to comment https://forums.phpfreaks.com/topic/209221-values-wont-get-inserted-why/ Share on other sites More sharing options...
Adam Posted July 29, 2010 Share Posted July 29, 2010 You have an extra comma at the end: (...) gmdate($date)',)"; mysql_error would have probably altered you to that. Quote Link to comment https://forums.phpfreaks.com/topic/209221-values-wont-get-inserted-why/#findComment-1092543 Share on other sites More sharing options...
xcoderx Posted July 29, 2010 Author Share Posted July 29, 2010 lol fixed. thanks soo much bro :-0, now the date and time not being inserted in database. its all 00000000 Quote Link to comment https://forums.phpfreaks.com/topic/209221-values-wont-get-inserted-why/#findComment-1092544 Share on other sites More sharing options...
Adam Posted July 29, 2010 Share Posted July 29, 2010 No worries! Quote Link to comment https://forums.phpfreaks.com/topic/209221-values-wont-get-inserted-why/#findComment-1092545 Share on other sites More sharing options...
PFMaBiSmAd Posted July 29, 2010 Share Posted July 29, 2010 gmdate() is a php function. You cannot put it inside a php string. When put inside of a string, your code is the characters 'g','m','d','a','t','e','(','$,'d','a','t','e',')'. Quote Link to comment https://forums.phpfreaks.com/topic/209221-values-wont-get-inserted-why/#findComment-1092548 Share on other sites More sharing options...
xcoderx Posted July 29, 2010 Author Share Posted July 29, 2010 what must i use then so that i get the users registration date and time? Quote Link to comment https://forums.phpfreaks.com/topic/209221-values-wont-get-inserted-why/#findComment-1092552 Share on other sites More sharing options...
PFMaBiSmAd Posted July 29, 2010 Share Posted July 29, 2010 You cannot put it inside a php string. Doesn't that suggest to you that you should put it on the outside of a php string? Quote Link to comment https://forums.phpfreaks.com/topic/209221-values-wont-get-inserted-why/#findComment-1092557 Share on other sites More sharing options...
xcoderx Posted July 29, 2010 Author Share Posted July 29, 2010 oops sorry didn read it well. yes outside of strings let me try Quote Link to comment https://forums.phpfreaks.com/topic/209221-values-wont-get-inserted-why/#findComment-1092562 Share on other sites More sharing options...
xcoderx Posted July 29, 2010 Author Share Posted July 29, 2010 now() did the job thanks guys. Quote Link to comment https://forums.phpfreaks.com/topic/209221-values-wont-get-inserted-why/#findComment-1092579 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.