M.O.S. Studios Posted March 26, 2009 Share Posted March 26, 2009 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! Link to comment https://forums.phpfreaks.com/topic/151286-solved-resting-a-mysql_fetch_array-pointer-to-0/ Share on other sites More sharing options...
lonewolf217 Posted March 26, 2009 Share Posted March 26, 2009 why not use in_array() instead of comparing every index to your value Link to comment https://forums.phpfreaks.com/topic/151286-solved-resting-a-mysql_fetch_array-pointer-to-0/#findComment-794705 Share on other sites More sharing options...
kenrbnsn Posted March 26, 2009 Share Posted March 26, 2009 You want to use the function mysql_data_seek. Ken Link to comment https://forums.phpfreaks.com/topic/151286-solved-resting-a-mysql_fetch_array-pointer-to-0/#findComment-794759 Share on other sites More sharing options...
M.O.S. Studios Posted March 26, 2009 Author Share Posted March 26, 2009 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 Link to comment https://forums.phpfreaks.com/topic/151286-solved-resting-a-mysql_fetch_array-pointer-to-0/#findComment-794806 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.