Hi
I am running some testing code to add the current time and current date to my database. Once I get this right I can mondify it to add to my website.
I get this error message
Warning: date() [function.date]: Windows does not support dates prior to midnight (00:00:00), January 1, 1970 in c:\program files\apache group\Apache\htdocs\internet salvage\time_test.php on line 62
$strTime =
Here's the code
<?php
$x_id = 10;
$x_id = (int)$x_id;
?>
<?php
$dbcnx = mysql_connect("localhost","root","mypassword");
if (!$dbcnx) {
exit('<p>Unable to connect to the database server at this time</p>');
}
if (!@mysql_select_db('total_loss')) {
exit('<p>Unable to locate the total_loss database</p>');
}
$query = "
INSERT INTO new_instruction SET
instruction_date=CURDATE(),
instruction_time=CURTIME(),
WHERE id = $x_id " ;
if (!mysql_query($query) )
{
// query failed, handle error;
}
?>
<?php
$dbcnx = mysql_connect("localhost","root","mypassword");
if (!$dbcnx) {
exit('<p>Unable to connect to the database server at this time</p>');
}
if (!@mysql_select_db('total_loss')) {
exit('<p>Unable to locate the total_loss database</p>');
}
$query = "SELECT instruction_date, instruction_time FROM new_instruction WHERE id = $x_id";
if (!$result = mysql_query($query) )
{
// query failed, handle error;
}
else
{
$row = mysql_fetch_assoc($result);
$dateField = $row['instruction_date'];
$timeField = $row['instruction_time'];
list($year, $month, $day) = split('-', $dateField);
list($hour, $min, $sec) = split(':', $timeField);
$strTime = date('j M H:i', mktime($hour,$min,$sec,$day,$month,$year));
echo "\$strTime = $strTime \n";
}
?>
Any help would really be appreciated
Thanks !