|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 Adam... ------------------ Q: What kind of person is worth becoming? A: The person you are now. |
|
#2
|
|||
|
|||
|
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. Regards, Peter |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > PHP Development > DATE data type for MySQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|