Jump to content

[SOLVED] resting a mysql_fetch_array pointer to 0


M.O.S. Studios

Recommended Posts

i need a db array to rest after i find the value I'm looking for so i can find the next value,

 

any one know how to rest it?? i tired using the reset() function but it didn't work, any ideas?

 

i know there is a lot going on in this

  while($db_catindex=mysql_fetch_array($db_products))
  {
   $i++;
   $cat_index=$db_catindex['cat_index'];
   while($db_catprice=mysql_fetch_array($db_catagory))
   {
    if($cat_index==$db_catprice['index'])
    {
     $percatform .= "if (myform.Qty".$i.".value != 0){var catvalue".$i." = (parseFloat(myform.Qty".$i.".value) * ".$db_catprice['shipping'].");}else{var catvalue".$i." = 0;}"."\n";
    }
   }
   reset($db_catprice=mysql_fetch_array($db_catagory));
}

 

 

thanks in advance!

hey guys,

thanks for the advice but this is what i ended up doing,

 

  while($db_catpricearray=mysql_fetch_array($db_catagory))
  {
   $db_catprice[]=array('index'=>$db_catpricearray['index'], shipping=>$db_catpricearray['shipping']);
  }

  while($db_catindex=mysql_fetch_array($db_products))
  {
   $i++;
   $cat_index=$db_catindex['cat_index'];
   for($ii=0; $ii<=count($db_catprice); $ii++)
   {
    if($cat_index==$db_catprice[$ii]['index'])
    {
     $percatform .= "if (myform.Qty".$i.".value != 0){var catvalue".$i." = (parseFloat(myform.Qty".$i.".value) * ".$db_catprice[$ii]['shipping'].");}else{var catvalue".$i." = 0;}"."\n";
    }
   }
   $ii=NULL;
}

 

i dont know why but out of the 3 ways this is the only one that gave me the end resault i needed

 

thanks again

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.