Are you really using "NOW(YY-MM-DD HH:MM:SS)"? I mean...that exact text?
That would be your problem, mate.
use:
$sql = "INSERT INTO domains ( dName, payPrYr, nextPayDay,timeChanged,
imeCreated ) ".
"VALUES ('$domainName', '$payPerYear', '$nxtPayDay', NOW(), NOW()";
and DO NOT end your query text with a semi-colon
-----Original Message-----
From: Olav Drageset [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 11:39 AM
To: [EMAIL PROTECTED]
Subject: Timestamp allways zero zero
Professionals!
I cannot get timestamp to contain a time value different from zero.
According to another mailing this shall happen when something is done wrong
I am completely new to databases. I am initiating the database tables from a
php
page.
Can anyone tel me what I am doing wrong??
Thank you.
Vreating table is like this:
$sql = "CREATE TABLE domains (";
//En record for hvert navnedomene
$sql .= "dNbr INTEGER UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,";
$sql .= "dName CHAR(25) NOT NULL,";
$sql .= "payPrYr SMALLINT DEFAULT 0 NOT NULL,";
$sql .= "nextPayDay DATE NULL,";
$sql .= "members SMALLINT DEFAULT 0 NOT NULL, ";
$sql .= "noPayMembers SMALLINT DEFAULT 0 NOT NULL,";
$sql .= "timeChanged TIMESTAMP (14),";
$sql .= "timeCreated TIMESTAMP (14),";
$sql .= "INDEX domain(dName))";
if (!$sql_result = mysql_query($sql,$connection) )
{echo "<P>query1: "; echo mysql_error();}
else {echo"<P>query1: domains ok";
this is one variant of writing to table:
$tid = "NOW(YY-MM-DD HH:MM:SS)";
$sql = "INSERT INTO domains ( dName, payPrYr, nextPayDay,timeChanged,
timeCreated ) ";
$sql .= "VALUES ('$domainName', '$payPerYear', '$nxtPayDay', '$tid',
'$tid' );";
if (!$sql_result = mysql_query($sql,$connection) )
{echo "<P>query1: "; echo mysql_error();}
else {
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php