December 22nd, 1999, 11:44 AM
Hi I'm trying to write to a database that contains a DATE data type... I used
$date = GETDATE();
$curDate = $date["year"] + "-" + $date["month"] + "-" + $date["mday"];
$result = MYSQL_QUERY("SELECT * FROM dbStats WHERE DBName = '$ELMDb' AND Date = '$curDate'");
it does not work right same when I try to reinsert values... for that date... I'm trying to update the Add and Delete count for that date for that db name...
$result = MYSQL_QUERY("INSERT INTO dbStats VALUES('$ELMDb', $curDate, $dbAdd, $dbDelete)");
any suggestions... thanks in advance
Q: What kind of person is worth becoming?
A: The person you are now.
December 23rd, 1999, 03:42 AM
You can also try it with the various datefunctions of MySQL, for example use NOW() for the current date:
e.g. insert into TABLE where date=NOW()
So you don't have to make difficult concatenations in PHP. If you only make a slight mistake, MySQL refuses to fulfill your command, without any warning.