HOW update time and date-fields to mysql....

From: Date: Tue, 28 Feb 2006 11:16:46 +0000
Subject: HOW update time and date-fields to mysql....
Groups: php.general 
Request: Send a blank email to php-general+get-231194@lists.php.net to get a copy of this message
Hi there guys! I have used a date-field and a time-field in a mysql-database. How should I update these fields through php? This is my code now (it works fine locally with data on a win-machine, but not on Linux at my webhotel - Time doesn't work at all) function safeQuote($value) { // Stripslashes if (get_magic_quotes_gpc()) {
      $value = stripslashes($value);
} // Quote if not integer if (!is_numeric($value)) {
      $value = "'" . mysql_real_escape_string($value) . "'";
} return $value; } $sql = "UPDATE tbforum SET"; $sql .= " question=" . safeQuote($frmQuestion); $sql .= ", insertDate='" . $dat . "'"; $sql .= ", insertTime='" . time() . "'"; $sql .= " WHERE IDForum=" . safeQuote($idForum); $querys = mysql_query($sql); /G

« previous php.general (#231194) next »