Jump to content

Recommended Posts

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.