Jump to content

binding a date variable and inserting to sql table


wright67uk

Recommended Posts

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
?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.