RE: [PHP-DB] More Date operations.
| From: | Beau Lebens | Date: | Fri, 01 Feb 2002 06:16:48 +0000 |
| Subject: | RE: [PHP-DB] More Date operations. | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-16383@lists.php.net to get a copy of this message | ||
you have changed the command from when you do it in mysql to when you do it
in php - you are leaving out the "'" quote marks around the date you are
passing :)
// $sql="SELECT TO_DAYS(2001-01-01) AS bar";
should be
// $sql="SELECT TO_DAYS('2001-01-01') AS bar";
HTH
beau
// -----Original Message-----
// From: Garry Optland [mailto:garry@pacificpower.com.au]
// Sent: Friday, 1 February 2002 2:12 PM
// To: php-db@lists.php.net
// Subject: [PHP-DB] More Date operations.
//
//
// Hi,
//
// 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");
// $days=mysql_fetch_array($result);
// 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?
//
// Regards,
// Garry.
//
//
//
// --
// PHP Database Mailing List (http://www.php.net/)
// To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
// For additional commands, e-mail: php-db-help@lists.php.net
// To contact the list administrators, e-mail:
// php-list-admin@lists.php.net
//