Hello all,
This is part of my code, if this looks familiar, it's taken from devshed.com:
code:
$getresults = mysql_query("SELECT * FROM Music_Library LIKE '%$search%'");
$resultsnumber = mysql_numrows($getresults);
IF ($resultsnumber == 0){
PRINT "Your search returned no results. Try other keyword(s).";
}
ELSEIF ($resultsnumber > 0){
PRINT "Your search returned $resultsnumber results<BR><BR>";
for($count = 0; $count<$resultsnumber; $count++){
$body = mysql_result($getresults,$count);
//tighten up the results
$body2print = substr($body, 0, 100);
$cnote = $count+1;
PRINT "$cnote. <a href=main.php>
<i>$body2print...</i></a><BR>";
}
}
?>
1. I'm getting this error
"Warning: Supplied argument is not a valid MySQL result resource in /home/omis107/main.php on line 45"
I believe line 45 is "$resultsnumber = mysql_numrows($getresults);"
Can anyone tell me what the problem might be?
2. And in this line
$getresults = mysql_query("SELECT * FROM Music_Library LIKE '%$search%'");
What code should I write for $search if I want to perform a search of a string taken from the search engine text box?
3. And if you would look at http://www.radio.deltapath.com/search_artist.html , notice the alphabets at the top of the page. I'm hoping that if let's say I click on "A", it would bring up a list of data from my music_library table that starts with "A". How should I do that? Is there any reference that you can link me to?
Thank you very much!
[This message has been edited by shattered (edited 03-09-2003).]
[This message has been edited by shattered (edited 03-09-2003).]