Re: mysql_result()

From: Date: Thu, 05 Apr 2001 08:55:12 +0000
Subject: Re: mysql_result()
References: 1  Groups: php.db php.general 
Request: Send a blank email to php-db+get-8255@lists.php.net to get a copy of this message
Thanks for everyones help with this one, all suggestions appreciated. Cheers, Jord On Wednesday 04 April 2001 17:06, you wrote: > Jordan, > > If you know your result is going to product one row, try using: > > $row=mysql_fetch_array($result, MSQL_ASSOC); > // returns an assoc array where the field names are keys, field value is > value > > $id=row[id]; > $name=row[name]; > etc. > > Best regards, > Andrew > -------------------------------------- > Andrew Hill - OpenLink Software > Director Technology Evangelism > eBusiness Infrastructure Technology > http://www.openlinksw.com > > -----Original Message----- > > > From: Jordan Elver [mailto:jjelver@worldsites.net] > > Sent: Wednesday, April 04, 2001 11:46 AM > > To: PHP Database Mailing List; PHP General Mailing List > > Subject: [PHP-DB] mysql_result() > > > > > > Hi, > > If I knnow that a query will only retrun one row, can I do thiss (below) > > rather than using a while loop for one record? > > > > $id = @mysql_result($result, 0, 'id'); > > $name = @mysql_result($result, 0, 'name'); > > $email = @mysql_result($result, 0, 'email'); > > $address1 = @mysql_result($result, 0, 'address1'); > > $address2 = @mysql_result($result, 0, 'address2'); > > $town_city = @mysql_result($result, 0, 'town_city'); > > $postcode = @mysql_result($result, 0, 'postcode'); > > > > Cheers, > > > > Jord > > > > -- > > 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 (#8255) next »