I am trying to access the MySQL function TO_DAYS() from PHP.

>From MySQL I can type in: SELECT TO_DAYS('2000-1-1') AS bar;

and I get:

| bar    |
| 730485 |
1 row in set (0.00 sec)

>From PHP, I have tried:

  $sql="SELECT TO_DAYS(2001-01-01) AS bar";
  $result=mysql_query($sql) or die("Could not access database");
  echo "days: ".$days["bar"]."<br>";

But I don't get the result coming through.

I have tried mysql_field_name and the name comes across as "bar".

mysql_num_rows shows that there is one row in the result. 

Am I missing something really really obvious? 


PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to