wright67uk Posted April 25, 2013 Share Posted April 25, 2013 I'm using a jquery datepicker, that outputs dates in the following format 04/30/2013 I've set the date column in mysql table as a date type, however when I submit the above date to the table all I get is 0000-00-00 Do I need to replace the forward slashes with dashes, for this to work? also am I right to think that, as the submitted date contains slashes, I should be binding the date as a string? <?php //an extract from my code $stmt = $mysqli->prepare("INSERT INTO toptips VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); $stmt->bind_param('isssssssss', $id, $time, $date, $course, $horse, $place, $odds, $description, $win, $tip); //end of extract ?> Quote Link to comment Share on other sites More sharing options...
Dathremar Posted April 25, 2013 Share Posted April 25, 2013 I dont know what You have inside those params ($time, $date), but in order to get that date 04/30/2013 into a date field in the db you need to get it into this format: yyyy-mm-dd. Quote Link to comment Share on other sites More sharing options...
seandisanti Posted April 25, 2013 Share Posted April 25, 2013 also, you should list the fields you're populating in parentheses after the table name, before the VALUES(...) 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.