hi, u can change your code like this:
if(trim($search_value) == "")
{
echo "No search query has been submitted";
}
else
{
$search_value = addslashes($search_value);
switch($search_in) {
case "artists":
global $database;
$query = "SELECT id, name FROM #__artdir_artists WHERE name LIKE '%$search_value%'";
$database->setQuery( $query );
$rows = $database->loadObjectList();
if(sizeof($rows) <= 0)
{
echo "No matching rows";
break;
}
foreach($rows as $row) {
echo "<a href=\"index.php?option=$option&task=singleArtist&id=$row->id\">$row->name</a><br />";
}
break;
case "cds":
global $database;
$query = "SELECT id, cd_name FROM #__artdir_cds WHERE cd_name LIKE '%$search_value%'";
$database->setQuery( $query );
$rows = $database->loadObjectList();
if(sizeof($rows) <= 0)
{
echo "No matching rows";
break;
}
foreach($rows as $row) {
echo "<a href=\"index.php?option=$option&task=showCD&id=$row->id\">$row->cd_name</a><br />";
}
break;
}
}
note that i added a line that quotes critical chars, e.g. " etc. - however, since i do not know which db u r usin, i used addslashes, u should replce this with the appropriate function in your db library - if u do not, users might be able to perform sql-injection attacks, so check your app and use functions that mask special chars on user input that is used in your sql query.
hth