You are here: Re: [PHP] mysql/php date functions.. « PHP « IT news, forums, messages
Re: [PHP] mysql/php date functions..

Posted by John Nichel on 09/26/05 21:00

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация