Hello
I have created an array from which I wish to run a query for each result in the array, but I cannot get it to work
so far I have got
$query = "SELECT CRef FROM tblUser WHERE CLogIn = '$username'"; // variable set earlier in code
$result = mysql_query($query)
or die (mysql_error());
$row = mysql_fetch_array($result);
$CRef = $row['CRef'];
$query = "SELECT MRef FROM tblResults WHERE aRef = '0' AND bRef = '0' AND CRef = '$CRef'";
$result1 = mysql_query($query)
or die (mysql_error());
while ($row1 = mysql_fetch_array($result1))
{
$MRef[] = $row1['MRef'];
}
foreach($MRef as $value)
{
$query = "SELECT (aRef) AS aRef, (bRef) AS bRef FROM `tblMachine` WHERE Id = '$MRef' ";
$result2 = mysql_query($query)
or die(mysql_error());
if ($result2)
{
echo $MRef;
echo '<br>';
echo $aRef;
echo '<br>';
}
} // close foreach
I have run print_r($MRef); to see what is int he array and it outputs a list such as Array ( [0] => 49 [1] => 110 [2] => 46 [3] => 59 [4] => 60 [5] => 79 etc.etc. which is what I was expecting but when I continue to try to output the other information I get
Array
Array
Array
etc.etc.
any ideas where I am going wrong - thanks