RE: [PHP]Only 1 Query Result...help.
| From: | Jason G. | Date: | Tue, 16 Oct 2001 06:41:51 +0000 |
| Subject: | RE: [PHP]Only 1 Query Result...help. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71176@lists.php.net to get a copy of this message | ||
The only difference between mysql_fetch_row() and mysql_fetch_array is:
fetch_row contains the following data:
Array
(
[0] => 20001
[1] => 996191721
[2] => Vickie
[3] => Glenn
)
fetch array contains twice as much data:
Array
(
[0] => 20001
[contact_id] => 20001
[1] => 996191721
[cpudate] => 996191721
[2] => Vickie
[firstname] => Vickie
[3] => Glenn
[lastname] => Glenn
)
conclusion: fetch_row is more efficient, but does it really make that much difference?
-Jason Garber
IonZoft.com
At 06:07 AM 10/16/2001 +0000, Philip Olson wrote:
On Tue, 16 Oct 2001, Dave Watkinson wrote: i don't think it's wise to create an array and fill it with one element i would use mysql_fetch_row($result) just my tuppence worth ;-) I don't see the difference, both are arrays with _row being enumerated. Perhaps you meant mysql_result(). At any rate, Chris was under the impression that a while() loop was required to use these _fetch_ functions when that's not the case. Using these functions to fetch one row of data is very appropriate, associative or otherwise. Regards, Philip Olson -----Original Message----- From: Philip Olson [mailto:philip@cornado.com] Sent: 15 October 2001 17:54 To: Chris Cocuzzo Cc: php-general@lists.php.net Subject: Re: [PHP]Only 1 Query Result...help.but without using a loop to display just one resultIf you want just one row : $row = mysql_fetch_array($result); print $row['col']; Regards, Philip Olson On Mon, 15 Oct 2001, Chris Cocuzzo wrote:maybe I'm an idiot, but I don't understand how that helps in not usingaloop to display the results. Could you explain a little more? thanks chris ----- Original Message ----- From: "_lallous" <elias_bachaalany@yahoo.com> To: <php-general@lists.php.net> Sent: Monday, October 15, 2001 3:30 AM Subject: Re: [PHP]Only 1 Query Result...help.buttonstry to see the SELECT * FROM table LIMIT max, offset see the LIMIT syntax. "Chris Cocuzzo" <cuzo@mediaone.net> wrote in message news:002b01c154f3$0a113310$ae687780@webs224... hey- I'm trying to put together a photo album system with next/previousclickthat displays one picture at a time, and obviously the user has tofor thethrough the buttons to navigate the pictures. I'm using this line$id";query $picquery = "SELECT picid,path,width,height FROM pics WHERE id =andnormally to display results I'd use the mysql_fetch_array functionit out like: $picdata[src]; what i was wondering if there's another function that I can usestructure sostick the results into an array or some other organized dataIresultcan display them, but without using a loop to display just onephp-list-admin@lists.php.netthanks chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail:php-list-admin@lists.php.net-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail:-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net