Is there a specific format that must be used to get a date from a form to inserted into a mysql db? I have 2 separate files that I am using, the first is the form where they enter the data that is stored. The second is the file that actually does the insertion.
I have set my variables to the following in the first file:
$ReqDate = date("Y-d-m");
This is automatically filled with the current date but can be modifed.
In the 2nd file I have the following code:
$db_name = "Hagerstown";
$table_name = "PlotRequests";
$connection = @mysql_connect("localhost", "dbname", "password") or
die("Could not connect");
$db = @mysql_select_db($db_name, $connection) or die("Could not select database.");
$sql = "INSERT INTO $table_name (ID, PlotNo, CustID, ReqDate, ReqTime)
VALUES ('$ID', '$PlotNo', '$CustID', '$ReqDate', '$ReqTime')
";
//result of mysql_query() function
$result = @mysql_query($sql,$connection) or die("Could not execute query.");
..........
<tr bgcolor="#edecfe">
<td width="34%" height="30"><strong><font color="#000000" face="Arial, Helvetica, sans-serif" size="2">Date
Requested : </font></strong></td>
<td height="30" colspan="5"> <strong><font color="#000000" face="Arial, Helvetica, sans-serif" size="2"><?php echo "$ReqDate"; ?>
</font></strong></td>
</tr>
Nothing is being inserted into the database.
Any suggestions?
TIA