1. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    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.
  2. #2
  3. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    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

Similar Threads

  1. SQL Server image data type
    By cf_greg in forum ColdFusion Development
    Replies: 5
    Last Post: October 18th, 2006, 09:01 PM
  2. Codepupil
    By Adachic in forum C Programming
    Replies: 3
    Last Post: February 6th, 2004, 06:50 PM
  3. Update Statement <--- Data Type Mismatch in Criteria Expression???
    By hbcontract in forum Visual Basic Programming
    Replies: 0
    Last Post: January 27th, 2004, 09:19 AM
  4. Replies: 5
    Last Post: January 22nd, 2004, 05:38 PM
  5. [urgent]C programming: data type conversion
    By bythesea in forum C Programming
    Replies: 5
    Last Post: January 18th, 2004, 09:34 AM

IMN logo majestic logo threadwatch logo seochat tools logo