LIKE %s with comma-separated entry
I am trying out to get a recordeset WHERE the column nameArtist 'contains' the URL parameter "artist". For example if "Picasso" is in the parameter and then it should find all projects which Picasso worked on. The problem is that often the column nameArtist contains more artist e.g. "Mondrian,Picasso,Chagall". it still should filter this project.
I tried with LIKE, but this does not give the projects when there are more artists.
I hope someone can give me a tip what I do wrong here.. Thankx.
$colname_rsAllprojects = "-1";
if (isset($_GET['artist'])) {
$colname_rsAllprojects = $_GET['artist'];
}
mysql_select_db($database_connCasco, $connCasco);
$query_rsAllprojects = sprintf("SELECT * FROM `2008_content` WHERE nameArtist LIKE %s ORDER BY projectyear DESC", GetSQLValueString($colname_rsAllprojects, "text"));
$rsAllprojects = mysql_query($query_rsAllprojects, $connCasco) or die(mysql_error());
$row_rsAllprojects = mysql_fetch_assoc($rsAllprojects);
$totalRows_rsAllprojects = mysql_num_rows($rsAllprojects);
