Codice PHP:
$tag=escape_string(trim($_POST['tag']));
$query="SELECT nomeimmagine FROM immagini WHERE tag LIKE %$tag%";
$equery mysql_query($query);