TobesC Posted October 6, 2008 Share Posted October 6, 2008 i know this is mysql, but can anyone find anything wrong with this query? the UNION command is the problem because i've tried all the SELECTS separately. query is: $result=mysql_query("SELECT * FROM `math` UNION SELECT * FROM `science` ORDER BY `timestamp` DESC"); mysql_fetch_array gives an invalid mysql resource. any help is greatly appreciated - this is driving me nuts. . . thanks. Link to comment https://forums.phpfreaks.com/topic/127260-union-command/ Share on other sites More sharing options...
R0bb0b Posted October 6, 2008 Share Posted October 6, 2008 first off, which table is your "timestamp" in, science? Link to comment https://forums.phpfreaks.com/topic/127260-union-command/#findComment-658232 Share on other sites More sharing options...
Barand Posted October 6, 2008 Share Posted October 6, 2008 And do math and science tables have the same number of columns of the same respective types Link to comment https://forums.phpfreaks.com/topic/127260-union-command/#findComment-658372 Share on other sites More sharing options...
DarkWater Posted October 6, 2008 Share Posted October 6, 2008 Also, can you get the error message from the mysql query so we actually know what the problem is? It should look something like: $result = mysql_query($query) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/127260-union-command/#findComment-658378 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.