OlmironovPizdobol
New Member
Using PHP and MySQL I'm trying to get all the distinct values out the number and type columns from all 4 of the tables listed below:\[code\]table_1ID|t1_number|t1_type1|1|new2|1|old3|2|new4|3|new5|1|oldtable_2ID|t2_number|t2_type1|1|future2|1|new3|3|past4|3|new5|1|newtable_3ID|t3_number|t3_type1|1|past2|1|new3|1|new4|1|new5|1|oldtable_4ID|t4_number|t4_type1|1|new2|4|new3|3|old4|2|new5|1|new\[/code\]The values I want from the above tables would be:numbers: 1,2,3,4types: new,old,future,pastHere is what I have so far; but I'm not sure if the SQL is correct or how to format the while loop to get the values out.\[code\]$sql = "SELECT DISTINCT table_1.t1_number, table_2.t2_number, table_3.t3_number, table_4.t4_number, table_1.t1_type, table_2.t2_type, table_3.t3_type, table_4.t4_typeFROM table_1 JOIN table_2JOIN table_3JOIN table_4";$result = @mysql_query($sql, $con) or die(mysql_error());while($row = mysql_fetch_array($result)) { $numbers= $row[?????????];}\[/code\]