First I am doing a query to the db to get data on a specific invoice number. This array consists of 1 entry of ":" delimted numbers that represent specific service ID's that need to be queried. I need all this information in a single array. Here is the code I have so far:
$invoice_id = "2503";
$result = mysql_query("SELECT i_services FROM invoices WHERE invoiceid='$invoice_id'");
$data = mysql_fetch_array($result);
// This results in an array, $data = "1:4:5:6:7:8:9";
// which is pulled from 1 entry in the table
// So I explode it to get an array of the numbers
$allservices = explode(":", $data[0]);
// Then do another query on each of these numbers, which are service id's in the database, also gathering more information
for ($i=0;$i<count($allservices);$i++)
{
$mysqlrt = mysql_query("SELECT *
FROM invoices, custinfo, services, availservices
WHERE invoices.invoiceid=$invoice_id
AND invoices.custid=custinfo.custid
AND services.serviceid=availservices.serviceid
AND custinfo.custid=services.custid
AND services.itemid='$allservices[$i]'");
$row = mysql_fetch_array($mysqlrt);
do {
echo "$row[username] $row[fname] $row[lname] $row[price]<BR>";
$totalprice .= ($row[price]);
} while($row = mysql_fetch_array($mysqlrt));
}
This all works nice and dandy. It prints out the correct information for each query in the loop it does. Problem is, I want ALL this information in the array at the same time, not X number of arrays. I couldn't figure out how to do a merge with the merge command this way, and I couldn't figure out how to do a mysql query for all the service id's at once. Help would be greatly appreciated.
Basically I just need an array of all the info composed from all the queries done in the for statement. I am pretty new to PHP and I have no clue where to go from here, it's been bothering me for hours. Thanks again!