LightningSt Posted June 17, 2008 Share Posted June 17, 2008 So I am trying to make a variable that will allow me to insert into a MySql database a date... I have three text boxes for year day and month and the format of the date field in the MySql is YYYY-DD-MM so my variable is trying to look like this... $date = $_POST['year'];-$_POST['day'];-$_POST['month']; but if i echo $date... it only echos the year and not the rest... i've tried putting the dashes like the following +'-'+ .'-'. ."-". Nothing is working for me... any suggestions? Link to comment https://forums.phpfreaks.com/topic/110606-date/ Share on other sites More sharing options...
kenrbnsn Posted June 17, 2008 Share Posted June 17, 2008 The concatenation operator is the ".", not ";" Do either <?php $date = $_POST['year'] . '-' . $_POST['day'] . '-' . $_POST['month']; ?> or <?php $date = "{$_POST['year']}-{$_POST['day']}-{$_POST['month']}"; ?> Ken Link to comment https://forums.phpfreaks.com/topic/110606-date/#findComment-567443 Share on other sites More sharing options...
PFMaBiSmAd Posted June 17, 2008 Share Posted June 17, 2008 The sql date format is yyyy-mm-dd (not yyyy-dd-mm) Link to comment https://forums.phpfreaks.com/topic/110606-date/#findComment-567452 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.