Jump to content

Searching Multiple tables for pagination


ballouta

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.