I have spent a lot of time working on this issue. I have been through the forums. I am begining to believe that my problem may have to do with variable declarations. PHP is presenting the variable in one type (I'm thinking string) and mysql is looking for it in another. I have tried using the (int) declaration to no avail. What I am trying to do is create a form where the user enters a date. That date is sent to Mysql for later retrieval. The pertinent code follows...
<?php
$daterec = $HTTP_POST_VARS['daterec'];
$battype = $HTTP_POST_VARS['battype'];
list($day, $month, $year) = split('[/.-]', $daterec);
$date = $year.'-'.$month.'-'.$day;
$battype = addslashes($battype);
$battquery = "insert into batterytable (BATTnum, DateRcvd, BattType, Availability) values (".$newnum.", '".$date."', '".$battype."', 0)";
mysql_query($battquery);
OK... get all that? Everything works with this except the date. The table (DateRcvd) is a "DATE" datatype. When I check the content of the table from the command line editor it comes up as "0000-00-00" so the problem must be here. I have looked for syntax and found nothing. As far as I can tell my syntax is correct. I am left to believe the problem lies in the presentation of the variable to Mysql. Any ideas?