Jump to content

MySQL search function help


patelp7

Recommended Posts

i got a search function and for some reason every results are pulled out twice.  Can sum1 PLEASE HELP!!!

 

$query = "select B.Bulletin_ID ,B.Subject, B.Description from Bulletin B, Relative R WHERE B.Adminusername = R.Adminusername AND  B.Description like '%$searchDesc%'";

 

above is the code in PHP.

I done it in MySQL as well without the loops that i have in PHP and the results still pulled out twice.

 

select B.Bulletin_ID ,B.Subject, B.Description from Bulletin B, Relative R WHERE 'shakeys' = 'shakeys' AND  'vw' like 'vw';

 

Does anyone know why? or have any ideas?

Link to comment
https://forums.phpfreaks.com/topic/48077-mysql-search-function-help/
Share on other sites

If you don't specify a join condition between Bulletin and Relative then each record in Bulletin is joined to each record in Relative.

 

Your first query does, the second doesn't. So which gives the problem? They're completely different.

 

Also "WHERE 'shakeys' = 'shakeys' AND  'vw' like 'vw' " will pull all records as vw is always equal to vw

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.