RE: [PHP-DB] mysql_fetch_array problem...!

From: Date: Mon, 05 Mar 2001 13:55:45 +0000
Subject: RE: [PHP-DB] mysql_fetch_array problem...!
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-7120@lists.php.net to get a copy of this message
Trond, What is your table structure? I'm guessing you need a different query. Also, be aware that mysql_fetch_array returns an array with the field name as value, so: $sql="select fields from table where id = $id"; $connection_handle=(mysql_connect($user, $pass, $host); mysql_select_db($database, $connection_handle); $result=(mysql_query($sql, $connection_handle); $i = mysql_fetch_array($result); echo $i[fieldname]; will produce a single result item. Best regards, Andrew -------------------------------------- Andrew Hill - OpenLink Software Director Technology Evangelism eBusiness Infrastructure Technology http://www.openlinksw.com > -----Original Message----- > From: Trond Erling Hundal [mailto:webmaster@port-industry.com] > Sent: Monday, March 05, 2001 7:56 AM > To: PHP-DB-LIST > Subject: [PHP-DB] mysql_fetch_array problem...! > > > I want to run a query to my db, fetching different fields from three > different tables. > In order to recognise the individual fields I give them names: > > select portal.portal as portal, portal.portalid as id... etc etc > > > How can I refer to one specific row in this query..? > What I mean is, how can i refer to result row number 4...? > > If I only selected rows from one table I could do something like this: > > $i = mysql_fetch_array($sql) ; > > echo "$i[4]" ; > > > > > -- > 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 (#7120) next »