nezbo Posted December 11, 2008 Share Posted December 11, 2008 Hi all I have 2 arrays one form the my sql database and on from an array. I have this code so far from the 'split'. if ($_REQUEST['order'] == ""){//Check if there has been any items been added $numberOfItems = 0;//Set the number of items to zero } else{//if items have been added $orderedItems = split(".:.", $_REQUEST['order']);//split item string in to an array $numberOfItems = count($orderedItems);//count the number of items The following code is from the mySQL $getOrderedItemsInfo = @mysql_query("SELECT * FROM ooh_drugs WHERE valid =0"); while($getOrderedItemsInfo = @mysql_fetch_array($getOrderedItemsInfo)) { } I am not to sure where to start, i was looking a foreach loop and i am not to sure how it works, or if it is the correct way to use it. Neil Link to comment https://forums.phpfreaks.com/topic/136474-arrays-with-mysql/ Share on other sites More sharing options...
Adam Posted December 11, 2008 Share Posted December 11, 2008 What are you trying to achieve? Link to comment https://forums.phpfreaks.com/topic/136474-arrays-with-mysql/#findComment-712331 Share on other sites More sharing options...
redarrow Posted December 11, 2008 Share Posted December 11, 2008 does this help hope so.. example only <?php //database connection $getOrderedItemsInfo ="SELECT * FROM ooh_drugs WHERE order >0 AND valid='0' "; $res=mysql_query($getOrderInfo)or die (mysql_error()); while($getOrderedItemsInfo = mysql_fetch_array($res)) { echo "Name of item: ".$getOrderedItemsInfo['name_of_item']." <br> Number of items: ".count($getOrderedItemsInfo['number_of_items'])." <br><br> "; } ?> Link to comment https://forums.phpfreaks.com/topic/136474-arrays-with-mysql/#findComment-712343 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.