RE: [PHP] mysql functions

From: Date: Tue, 10 Feb 2004 10:19:57 +0000
Subject: RE: [PHP] mysql functions
Groups: php.general 
Request: Send a blank email to php-general+get-177264@lists.php.net to get a copy of this message
Use mysql_result and u can use mysql_fetch_object, mysql_fetch_array also. The following example will show u how to do it with mysql_result which will retrive one row only. From PHP Manual: <?php $link = mysql_connect("localhost", "mysql_user", "mysql_password")
           or die("Could not connect: " . mysql_error());
$result = mysql_query("SELECT name FROM work.employee")
           or die("Could not query: . mysql_error());
echo mysql_result($result,0); // outputs first employee's name mysql_close($link); ?> Regards, Hamid Hossain ----------------------- Check Amazon.com Latest PHP books: http://www.amazon.com/exec/obidos/redirect?tag=zawraqclassif-20&path=tg/browse/-/295223 Start Accepting CreditCard at your site in minutes: http://www.2checkout.com/cgi-bin/aff.2c?affid=106720 Download Alexa Tool Bar to stop Pop-ups for FREE: http://download.alexa.com/?amzn_id=zawraqclassif-20 Download Ready-Made Templates for your site: http://www.aplustemplates.com/cgi/affiliates/c1.cgi/zawraq_ad ----Original Message Follows---- From: "Angelo Zanetti" <binc2@ctech.ac.za> Reply-To: <binc2@ctech.ac.za> To: "Php-General@Lists.Php.Net" <php-general@lists.php.net> Subject: [PHP] mysql functions Date: Tue, 10 Feb 2004 11:44:47 +0200 I have a query which returns only 1 row, which of the following would be the best to get the value from the resultset: mysql_result() mysql_fetch_field() mysql_fetch_row() the resultset only returns 1 column, so basically its only 1 field i get from the resultset. thanx in advance. angelo -------------------------------------------------------------------- Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Technikon or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _________________________________________________________________ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail

« previous php.general (#177264) next »