View Single Post
Old 03-25-2003, 02:26 PM   #4 (permalink)
pngwyn
Registered User
 
pngwyn's Avatar
 
Join Date: Mar 2003
Location: Boise, Idaho
Posts: 4
pngwyn is on a distinguished road
Send a message via ICQ to pngwyn Send a message via AIM to pngwyn Send a message via Yahoo to pngwyn
Another Option

Method #2 is certainly *much* quicker and less taxing.

I will assume that $i is suppose to be incrementing. You may find the comments in the code below helpful.

PHP Code:
<?
// I assumed "Select *"
// Additionally, it would be quicker to ask for just the fields you 
// need in the order you need them in.

$result=mysql_query("SELECT * FROM contacts WHERE field='$field'")

$i=0;

while(
$row=mysql_fetch_array($result)) {
// It isn't necessary to define each variable.  Simply write the
// result set to your multidimensional array.

// Additionally I assume you are using mysql_fetch_array rather 
// than fetch_row by the way you are referring to the vars.
  
$multi[$i][$row];
  
$i++; 
}

// then a quicker loop would be:
for($ii 0$ii >= $i$ii++) {
   
// Additionally you could nest a loop here.
   
print("$multi[$ii][fieldName]");
   print(
"$multi[$ii][0]");
}

// to get a good look at your result set use the print_r command
print_r($multi);
?>
pngwyn is offline   Reply With Quote