RE: [PHP-DB] non-db selections in mysql, php

From: Date: Sun, 09 Jul 2000 10:10:04 +0000
Subject: RE: [PHP-DB] non-db selections in mysql, php
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-986@lists.php.net to get a copy of this message
Not too sure what you mean but, if all you wanted is the weekday() result from MySQL then you can just do this: $weekday = "20000704010101"; $sql = " SELECT WEEKDAY($weekday) AS myWeekday "; $conn = mysql_connect("localhost", "dbusername", "dbpassword"); // connect to DB $result = mysql_db_query("your_db_name",$sql,$conn); // get the // execute query $row = mysql_fetch_object($result); $MySQLweekday = $row->myWeekday; // fetch result mysql_free_result($result); Of course you'll need more error checking etc in your real code. You can also get weekday in PHP via the function named getdate(); Check out PHP date/time function manual at: http://www.php.net/manual/ref.datetime.php > > Greetings. > > I understand how to use PHP/MySQL to query the database and > return the record I want.... but i need to use MySQL's date and > time functions apart from a record selection, and I can't figure > out which of PHP's mysql functions to use ... > > e.g. the mysql statement "select weekday(20000704010101) is a > valid query in MySQL... > but how did I read this statement in conjunction with PHP to read > the result? > > Thanks in advance, > > Kenn > \ > > -- > 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 > >

« previous php.db (#986) next »