Re: mysql_fetch_array problem...!

From: Date: Mon, 05 Mar 2001 23:15:46 +0000
Subject: Re: mysql_fetch_array problem...!
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-7127@lists.php.net to get a copy of this message
You must use a loop to show each row of your query. "mysql_fetch_array($result)" only get the current row. while($row = mysql_fetch_array($result) ){ // do something } The "mysql_fetch_array" function returns an associative array where you can use the field names to have access to its value : $row = mysql_fetch_array($result) ; $v1 = $row["fieldname1"] ; $v2 = $row["fieldname2"] ; $v3 = $row["fieldname3"] ; You're going to use the alias names you are creating on the query. See more details on php manual at mysql functions. HTH. Jayme. -----Mensagem Original----- De: Trond Erling Hundal <webmaster@port-industry.com> Para: PHP-DB-LIST <php-db@lists.php.net> Enviada em: segunda-feira, 5 de março de 2001 09:56 Assunto: [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 (#7127) next »