Hi!
As I am fairly new to MySql and the PHP language you must forgive me for asking questions that might seem simple. This is my problem:
I am creating a search script for a webpage which has several tables with information to be searched in, for example:
Table CD, DVD, TECH etc
These tables has ID autoincrement and several other columns. To conduct a search in all tables in one query I have created a script that indexes these tables into a new table. The new table has the columns ID (autoincr) POST_ID (id from the indexed table), POST_TYPE (which type of table the index comes from, CD, DVD, TECH etc), INDEXTABLE (containing text from all columns in one chunk).
Now when I have the index table containing everything from all the other tables i can do a query on it and the result will be a recordset containing ID, POST_ID, POST_TYPE, INDEXTABLE. This is just fine, I could easily create a loop with links to a detailpage that checks the POST_TYPE and then gets the row with the POST_ID and display it. However, since the indextable has all the text/info in one column it is hard to display the result of the query in a nice way. So what I want to do is to create a query which gets all the rows from the indextable that matches the searchstring, and then match the result with the "real" tables and then create the list of results writing it out from the "real" tables. I know this could be done with JOIN but as I am a newbie I dont know how. I presume one has to match all the rows by POST_TYPE and then by POST_ID since the result from the query migth very well contain rows where the POST_ID's are identical, since they originate from three different tables. If anyone has the time please give me a hint on this. BR / bjarman.org