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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux