ballouta Posted October 23, 2010 Share Posted October 23, 2010 Hello 1) I am reading two good tutorials for building a search page with pagination: http://www.phpfreaks.com/tutorial/basic-pagination http://php.about.com/od/phpwithmysql/ss/php_pagination.htm Before I ask the big question, I would like to know how does a query look like when searching multiple tables (e.g three) in the same time. Table1/Table2/Table3. May you kindly give me example? 2) The problem is that I have multiple tables with the same structure to search e.g. (title, body) a) how I will know the ROWS NUMBER returned by the search query? it doesn't look a smart way to query each table and them count the results, and this basically takes much time right? b) when displaying the result, how I will be able to set the correct hyperlink for each result? you know, each table is a different subject, each one is located in different folder. Thank you SO MUCH Quote Link to comment https://forums.phpfreaks.com/topic/216629-searching-multiple-tables-for-pagination/ Share on other sites More sharing options...
dreamwest Posted October 23, 2010 Share Posted October 23, 2010 if your joining tables make sure each has a prefix, your basically smashing three tables together $res = mysql_query("SELECT * FROM table1 as a, table2 as b, table3 as c WHERE a.field='stuff' etc.... "); Join as many as you like Also index any joined fields and delay key write for speedy gonzalez Quote Link to comment https://forums.phpfreaks.com/topic/216629-searching-multiple-tables-for-pagination/#findComment-1125544 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.