Hi,

I have run the small test below:

mysql> create table test (
    -> f1 int,
    -> ts timestamp);
Query OK, 0 rows affected (0.40 sec)

mysql> insert into test values (10);
ERROR 1136: Column count doesn't match value count at row 1
mysql> insert into test (f1) values (10);
Query OK, 1 row affected (0.00 sec)

mysql> select * from test;
+------+----------------+
| f1   | ts             |
+------+----------------+
|   10 | 20011216165040 |
+------+----------------+
1 row in set (0.00 sec)

So I think you must enumerate all fields you are actually setting before
'VALUES' in your query.

Regards
--
Joseph Bueno
NetClub/Trader.com

*Himerus* a écrit :
> 
> My timestamp is doing the same thing... with inserting 0's ... but if I
> leave it out of the insert query, it wont update, because the field is
> missing... I have the insert and also a mail() function that lets me
> know every time an entry has been made, and when I first tried the
> timestamp, it just didn't update the database, but it still sent me the
> mail???
> 
> Any help would be great....
> 
> Here's the insert function...
> 
> $sqlquery = "INSERT INTO $table
> VALUES('$idnum','$firstname','$lastname','$addy1','$addy2','$city','$sta
> te','$zip','$zip2','$homephone','$workphone','$email','$homepage','$mont
> hdob1','$daydob1','$yeardob1','$relationship','$monthdob2','$daydob2','$
> yeardob2','$gender','$adopteename','$placeofbirth','$city2','$county','$
> state2','$agency','$bmothername','$mage','$monthmdob','$daymdob','$yearm
> dob','$bfathername','$fage','$monthfdob','$dayfdob','$yearfdob','$commen
> ts','$signupdate')";
> 
> $signupdate is the one that I wanted to be the timestamp obviously!!!
> LOL
> 
> Thanks in advance for any help someone can give me....
> 
> -----Original Message-----
> From: Robert Alexander [mailto:[EMAIL PROTECTED]]
> Sent: Friday, December 14, 2001 1:11 PM
> To: Steve Osborne
> Cc: [EMAIL PROTECTED]
> Subject: Re: Fw: timestamp additional info
> 
> At 12:18 -0800 2001/12/14, Steve Osborne wrote:
> > Timestamp additional info:
> >
> > INSERT INTO Owners (NameID,ProductsKey,RegNum,ProdRegDate)
> >VALUES ('$NameID','1','$RegNumc','NULL');
> >
> >ProdRegDate is the field that I want to timestamp. (Again, I've tried
> > passing '', NULL, and 'NULL').
> >
> > Steve
> 
> Hi Steve,
> 
> You don't need to (and shouldn't) specify the timestamp field in your
> query at all. If it's defined in the table, it'll update automatically
> when you insert or update the record.
> 
> In the example above, you're specifically setting it to NULL or an empty
> string -- it's taking it's best shot, and filling the column with '0's.
> :>
> 
> HTH
> 
> /Rob
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Robert Alexander, Alpha Geek, Workmate.ca
> WWW Database Applications and Web Hosting
> http://www.workmate.ca       416-823-6599
> mailto:[EMAIL PROTECTED]
> 
> "Life's unfair - but root password helps!"
> 
> ---------------------------------------------------------------------
> 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

---------------------------------------------------------------------
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

Reply via email to