Page 1 of 1

Search String Help: Display Specific Letter

Posted: Sun Apr 04, 2004 7:59 pm
by palmere
Hi all,

I'm in the process of converting another script that uses PHP to access a mySQL database from a search script to a script that displays results by a specified letter (i.e. display all artists that beging with a, b, etc). Here's the search string that the script currently uses:

Code: Select all

if ($dvd_search != "") { $dvd_search_string = " WHERE ". $dvd_search_type . " like "%" . $dvd_search . "%""; }
I would like to change the $dvd_search variable to a $_GET['beta'] variable, but i keep getting parse errors when I make the change. I'm willing to bet that I'm overlooking something drastically simple. Thanks a million guys.

E

Posted: Sun Apr 04, 2004 8:21 pm
by markl999
Try:

if (!empty($_GET['beta'])) {
$dvd_search_string = ' WHERE '. $dvd_search_type . ' like "%' .$_GET['beta']. '%"';
}

Posted: Sun Apr 04, 2004 11:00 pm
by palmere
Like a charm.

All I had to do was drop the first %. Thanks much.

E