php/mysql search display

I am trying to link one variable in the search results to its corresponding variable which is in the same row but on a different field result.

For Example
[b]title || lyrics[/b]
father || am i so proud to be your son...

If I search for father, I get father in the search results.

I am trying to get the title "father" to be displayed as a link so that when it is clicked, the lyrics: "I am so proud to be your son" will be displayed on screen. It can either be a pop up window or a new screen.

I tried linking the title to the lyrics with...


in the part of my script that prints the search results. The value if id was assigned to variable id like this


it takes me to a page with no results. Please help...

This is my script...

//-query the database table
$song="SELECT title,writers.Author,bible.ref,lyrics FROM writers LEFT JOIN bible ON writers.SongNo = bible.SongNo WHERE (`title` LIKE '%" . $name . "%' OR `Author` LIKE '%" . $name . "%')";

//-run the query against the mysql query function

//-create while loop and loop through result set
$num_rows = mysql_num_rows($result);

echo "
echo "

Search for '$name' found $num_rows


$Author =$row['Author'];
$rest = substr("$lyrics",0,180);
//-display the result of the array

echo "Sorry, search found zero results."; //if there are zero rows, then it will echo this out.
} else {
print '

Song title : '.$title.'
print "Author: $Author
" . "Reference: $ref
" . "Lyrics: $rest

echo "

Please enter search term, we suggest the name of an author or a song title



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!