RE: [PHP] mysql/php date functions..

From: Date: Mon, 26 Sep 2005 18:15:18 +0000
Subject: RE: [PHP] mysql/php date functions..
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-223215@lists.php.net to get a copy of this message
along the same way... why can't i see the timestamp designation (ie the double/int) instead of the date-time format when i look at the timestmp var when i do a 'select * from t1' within mysql?? arrgghh! -bruce -----Original Message----- From: John Nichel [mailto:john@kegworks.com] Sent: Monday, September 26, 2005 11:00 AM To: php-general@lists.php.net Subject: Re: [PHP] mysql/php date functions.. bruce wrote: > how can i create a mysql sql statement to insert a php 'time()' into mysql? > > i've got the mysql var 't1, timestamp' but i can't figure out how to do an > insert > > $q = time(); > $sql = sprintf("insert into foo (id, ctime) values(%d, %???), $id, $q); > > can't figure out how to get this to work... > > if i create a sql statement and run it directly within mysql, > > -->insert into foo (id, ctime) values(2, NOW()); > > this works.. but i can't figure out how to create the sql using the php > time() function and getting the insert from the php app... > > so what's the basic part i'm missing??!! > > -bruce $sql = "INSERT INTO db.table ( id, ctime ) VALUES ( " . $id . ", " . time() . " )"; -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 john@kegworks.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#223215) next »