[PHP] Re: date for mysql

2003-10-17 Thread pete M
insert into table (date_created) values( now() )

;-)
pete
Diana Castillo wrote:

how can I format the current date and time so that I can insert it into a
mysql table with an insert query?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: date from mysql

2002-08-29 Thread David Robley

In article 01ae01c24f4f$51dc7bd0$b50a@web18, [EMAIL PROTECTED] says...
 i want Y (year format) printed on my php script (looping), i already tried
 it but i got same Year format (ex 1978) in all row in my table
 
 my loop script  is:
 
 
 $query  = (select * from table);
 $result = mysql_query($query);
 while ($row = mysql_fetch_row($result))
 $number =  mysql_numrows($result);
 
 
 $i = 0;
 while ($i  $number):
 $date  = mysql_result($result, $i,$date);
 
 if ($i%2 == 0){
 
 echo b$date/b;
 if ($i%2 == 0){
 echo $date;
   }
 $i++;
 ENDWHILE;

If the date is stored in one of MySql's date type fields, you could use 
the mysql DATE_FORMAT function to format your date.

I think the logic of your looping above is a bit suspect??

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php