[PHP] Hi what is the prob with this small file?

2002-03-14 Thread Balaji Ankem

Hi friend,
I am getting null values (0) for the following program.
what will be the problem?
Any help greatly appreciable!!

example.php
===
?php

// Connect to MySQL
$connection = mysql_connect( 'localhost', 'balaji', 'pingpong'
);


// Select database on MySQL server

mysql_select_db( 'amerm' )
or die ( 'Unable to select database.'.mysql_error());

// Formulate the queries

$sql1=select UNIX_TIMESTAMP('start_date')
startdate,UNIX_TIMESTAMP('end_date') enddate  from request where
req_status='Approved';

$result1=mysql_query($sql1) or die ('Error in
sql1'.mysql_error());

$n=mysql_numrows($result1);

echo 'number of rows:'.$n;

while($row=mysql_fetch_object($result1))
{
echo
'starttime'.$row-startdate.'endtime'.$row-enddate;
}

   mysql_close($connection);

?
=

I am getting values printed is 0.

Actually UNIX_TIMESTAMP(2001:03:21 10:45:00) means what?
What it returns?

Thanks in advance
Balaji




**Disclaimer
  


Information contained in this E-MAIL being proprietary to Wipro Limited
is 'privileged' and 'confidential' and intended for use only by the
individual or entity to which it is addressed. You are notified that any
use, copying or dissemination of the information contained in the E-MAIL
in any manner whatsoever is strictly prohibited.



 



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


Re: [PHP] Hi what is the prob with this small file?

2002-03-14 Thread Jason Wong

On Thursday 14 March 2002 17:38, Balaji Ankem wrote:

[snip]

   $sql1=select UNIX_TIMESTAMP('start_date')
 startdate,UNIX_TIMESTAMP('end_date') enddate  from request where
 req_status='Approved';

Did you try entering this query ($sql1) into mysql at the command line to 
ensure that it's valid and returns some results?


 I am getting values printed is 0.

 Actually UNIX_TIMESTAMP(2001:03:21 10:45:00) means what?
 What it returns?

UNIX_TIMESTAMP returns the number of seconds between the unix epoch 
(1970-01-01 00:00:00) and the date.


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
A certain amount of opposition is a help, not a hindrance. Kites rise
against the wind, not with it.
*/

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