My two tables look like this:
TABLE1 TABLE2
+--------------------+ +--------------------+
|field1|field2|field3| and |field2|field4|field5|
+--------------------+ +--------------------+
I am already running a SELECT query for TABLE1, and assorting all of the data into variables:
$query = "SELECT * FROM TABLE1 WHERE field2 = 2";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);
if((!is_bool($result) || $result) && $num_rows) {
while($row = mysql_fetch_array($result))
{
$field1 = $row['field1'];
$field2 = $row['field2'];
$field3 = $row['field3'];
}
}
What I want to do is get the data from 'field4' on TABLE2 and add it to my variables. I would want to get field4 WHERE field2 = 2