hey there
ive been tryin to do this for a while now and im having no luck.
the question is, is there a way of assigning each value returned from the sql query and assinging them to a single array. for example i have a a query like so;
$table = "sales_table";
$query = "select treatments from $table where
date between '21/08/2006' and '25/08/2006'";
$result = mysql_query($query);
because the values stored in the treatments field are imploded as a single string when the user submits the form the value looks like; 1, 22, 33.
these numbers represent the treatment id in the treatments table, so in thuis example the user purchased 3 treatments. to display the results i use;
while( $data = mysql_fetch_array($result,MYSQL_ASSOC))
{
$pieces = explode(",", $data['treatments']);
foreach($pieces as $value)
{
$query2 = "select * from treatment_codes where treatment_id = $value";
$result2 = mysql_query($query2);
while($data2 = mysql_fetch_array($result2))
{
$description = $data2['treatment_description'];
echo "\"$description\"<br>";
}
}
}
the thing is instead of just displaying the results i want to put each value into an single array how could this be done? like i said i have tried every thing i can think of.
cheers any help would be appriciated