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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.