AyKay47 Posted July 29, 2011 Share Posted July 29, 2011 Hey guys, i have a weird issue that I have been trying to debug for almost an hour, can't wrap my brain around it.. I am using the Jquery UI datepicker with an input for a birthday, however even when I take this function out I am having issues which leads me to believe that it is something that mysql is doing.. When I try to insert the date into my table i receive the value of "--" instead of the date..my field to is set to VARCHAR which is why I am not understanding why it would be doing this....heres the relevant code.. in snippets if(preg_match($pattern,$_POST['b_date'],$match)){ $birthday = $match[0]; //set birthday variable from preg_match, this works fine }... $sqlcmd = "INSERT INTO members (first_name, last_name, email, password, b_date, gender, ip, date , randnum, activated) VALUES('$firstname','$lastname','$email','$dbpassword','$birthday','$gender','$ipaddress', '$date', '$randnum', 0)"; $query = mysql_query($sqlcmd) or die (mysql_error()); //inserts the data fine, except for the "--" comes from this input <input type="text" name="b_date" id="birthday" class="input_search_text2" /> Link to comment https://forums.phpfreaks.com/topic/243206-mysql-inserting-from-datepicker/ Share on other sites More sharing options...
Muddy_Funster Posted July 29, 2011 Share Posted July 29, 2011 This sounds a lot like either an escaping issue, or a delimiter problem - what do you get if, you post sample data, as the contents of $birthday and $sqlcmd? Link to comment https://forums.phpfreaks.com/topic/243206-mysql-inserting-from-datepicker/#findComment-1249118 Share on other sites More sharing options...
AyKay47 Posted July 29, 2011 Author Share Posted July 29, 2011 even if I force the value of $birthday to a string like "08/04/1988" mysql is still inserting "--".. Link to comment https://forums.phpfreaks.com/topic/243206-mysql-inserting-from-datepicker/#findComment-1249140 Share on other sites More sharing options...
AyKay47 Posted July 29, 2011 Author Share Posted July 29, 2011 I have figured this one out, I had a variable from a previous method named $birthday as well that was overwriting my variable...thanks alot for your help Link to comment https://forums.phpfreaks.com/topic/243206-mysql-inserting-from-datepicker/#findComment-1249146 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.