Re: search query problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To start with:
Go to one of the on-line SQL tutorail sites and learn how to formulate a query.
Then make a simple query, and figure out how it works.
After that add fields from related tables, one table at a time,
so that you can see the effect of how joining tables works.


Also, watch how you name your fields. "Date" is a reserved word in MySQL, do not use it as a field name, you're only creating potential trouble. Check the MySQL docs for reserved words.

Your present query lacks a FROM clause which is one reason it won't work. Nor do you have any join conditions to link the tables.

Rather than trying to fix this, which is a bit of a hash, start with the basics, then work up to more complex queries.

Regards - Miles Thompson



At 10:53 AM 7/26/2003 +0300, Ahmed Abdelaliem wrote:
hi
i am making a simple search form
how can i search more than one table for the same word
i used a query and it failed
here it is
@ $db = mysql_connect("localhost");
mysql_select_db("egycds");


$test_tr = mysql_query("select newdvd.date, newpcgames.date, olddvd.date, screener.date,
newdvd.type, newpcgames.type, olddvd.type, screener.type,
newdvd.name, newpcgames.name, olddvd.name, screener.name,
newdvd.cds, newpcgames.cds, olddvd.cds, screener.cds,
newdvd.downloader, newpcgames.downloader, olddvd.downloader, screener.downloader, where newdvd.name like '%".$word."%'
or newpcgames.name like '%".$word."%' or olddvd.name like '%".$word."%' or screener.name like '%".$word."%'");

<rest snipped - let's concentrate on the query!>



-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux