Hello,
I have two different tables I need to extract data from. They are linked by a number, that is to say the value of the field 'number' in table 1 is the same value as the value of the field 'num' in table 2.
I can select data from the first table fine, however I get issues when trying to get data from the second table:
while ($row = mysql_fetch_array ($results)) { #First table results, this loop works fine
$data = sprintf (SELECT * FROM table_2 WHERE num = '%s'", $row['number']);
$foo = mysql_query ($data);
$bar = mysql_fetch_array ($foo);
echo $bar['field_name'];
}
This only works on the FIRST iteration of the loops. Subsequent iterations, while they do execute (I can access the changing values of $row fine) do seem to make the call to mysql_fetch_array or the echo statement. It doesn't even echo the same thing over and over again; it acts as if it doesn't exist.
I can verify that resource $foo is also changing each iteration through the loop.
Thanks for any help you can provide.