MySQL Forums
Forum List  »  Newbie

Re: Newbie question
Posted by: Nick Roper
Date: August 07, 2004 03:56AM


Another thing for you to be aware of. mysql_result() is not a very efficient method of retrieving data. mysql_fetch_array() or mysql_fetch_row() are faster.

For example:

$x = 0;

while (($row = mysql_fetch_array($sql)) && ($x < $n_subcategories)) {

$subcategories[$x]["subcategories"] = $row['subcategories'];


Or, if you want the data from all rows:

$x = 0;

while ($row = mysql_fetch_array($sql)) {

$subcategories[$x]["subcategories"] = $row['subcategories'];


This is off the top of my head - you may need to check the syntax, but I think it's right.

For documentation on these functions, try:


Nick Roper

Options: ReplyQuote

Written By
August 06, 2004 11:01PM
August 07, 2004 03:36AM
Re: Newbie question
August 07, 2004 03:56AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.