List:General Discussion« Previous MessageNext Message »
From:Naim Date:May 10 2004 10:00am
Subject:Searching in several tabels
View as plain text  
Hi All

I have a database with several tabels. Example:

Database articles:

Table1:
id 
name
title
tekst

Table2
id
name
title
tekst

Table3
id 
name
title
tekst

Now I want to search for a specifik title within all the database and then print the
result - how do I do that.

I have tried with:

<? mysql_connect("localhost", "nobody"); mysql_select_db("mydatabase");
             
             $tilWhile = mysql_query("SELECT * FROM table1='$_GET[id]' OR
table2='$_GET[id]' table3='$_GET[id]' ");
             $resultater = mysql_num_rows($tilWhile);
               while ($row = mysql_fetch_array($tilWhile)){
             print "$row[tekst]"; #// Give me the tekst from the article which has that
title (the title contained in $_GET[id].
                 }
             mysql_close();
             ?>

I know this is partly a PHP question but the problem lies within the SELECT. I get
"Supplied argument is not a valid MySQL"

Try not to look to hard at my PHP because it might be better to do it in a different way.
I am using MySQL 4.

Thanks

Naim

Thread
Searching in several tabelsNaim10 May
  • Re: Searching in several tabelsEgor Egorov10 May