Diana Kay Publishing

For authors, writers, publishers

Song Writer Database

without comments

php, mysql, database search instruction...?

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";

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.

Re: Original Music Database - (No Cover Songs)

Hi fellow writers, check out the Song Writer Database products below:

No items matching your keywords were found.

Written by Keith Lee

July 23rd, 2011 at 7:37 pm

Leave a Reply