kalster Posted October 15, 2014 Share Posted October 15, 2014 how can i join the two queries so that they function as one. for example, if $keywords or $username is empty then the result will be null. $query1 = "SELECT * FROM forums WHERE MATCH (topics) AGAINST ('$keywords' IN BOOLEAN MODE)"; $query2 = "SELECT * FROM users WHERE username='$username"; Quote Link to comment https://forums.phpfreaks.com/topic/291644-joining-two-queries-as-one/ Share on other sites More sharing options...
jdavidbakr Posted October 15, 2014 Share Posted October 15, 2014 Not sure what you mean - what kind of data structure are each of the tables and what do you want your result set to look like? Quote Link to comment https://forums.phpfreaks.com/topic/291644-joining-two-queries-as-one/#findComment-1493651 Share on other sites More sharing options...
Barand Posted October 15, 2014 Share Posted October 15, 2014 You would use either a JOIN or a UNION. Which one you use would depend on the structure of your tables and the structure of the desired output. Quote Link to comment https://forums.phpfreaks.com/topic/291644-joining-two-queries-as-one/#findComment-1493652 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.