php, mysql, database search instruction...?

spacecadet100

New member
I think you need paranthasis like this:

AND (`Author` LIKE '%" . $name . "%' OR `title` LIKE '%" . $name . "%') AND 'lyrics' ...

The OR statement in the original sql query will bring up title LIKE %$name% whether the songno matches or not.
 
I think you need paranthasis like this:

AND (`Author` LIKE '%" . $name . "%' OR `title` LIKE '%" . $name . "%') AND 'lyrics' ...

The OR statement in the original sql query will bring up title LIKE %$name% whether the songno matches or not.
 
I have two different tables with related information, both use a field with a common id as a means for matching results between them.

I am trying to search from the two related tables, but my script also produces some results that do not match. The matching key field is SongNo (e.g 1945, 1985 etc), each table has a field with SongNo.

This is my search instruction.


$song="SELECT * FROM bible, writers WHERE `bible`.`SongNo`=`writers`.`SongNo` AND `Author` LIKE '%" . $name . "%' OR `title` LIKE '%" . $name . "%' AND `lyrics` IS NOT NULL AND `ref` IS NOT NULL LIMIT 0 , 30";
 
Back
Top