Hi i am trying create a tag filtering function where images can be filtered using tags. Specifically i am having trouble passing the tagz array, this may be down to my table setup, either way any help with the SQL or any other part of the code would be greatly appreciated. Thanks in advance.
<?php
if (@mysql_connect('*****','*****','****')) {
if (mysql_select_db('****')) {
$tagz = $_REQUEST['tagz'];
$tagz = mysql_real_escape_string($tagz);
$tagz = implode(", ", $tagz);
$query = " SELECT boxes . BNO, boxes . BName, boxes . URL, images . Ipath FROM boxes LEFT JOIN images ON boxes . INO = images . INO LEFT JOIN links ON boxes . BNO = links . BNO WHERE links . TNO LIKE '$tagz' ";
$query_run = mysql_query($query);
} while ($query_row = mysql_fetch_assoc($query_run)) {
echo $row ='<li id='.$query_row['BNO'].' class="box">;
}
}
?>
Have you tried to echo out $tagz and then execute the SQL manually to ensure it works? Might just be a logic issue within the SQL or a dud character breaking the SQL.
Also consider switching to mysqli or pdo, it’ll eliminate the need to escape_string tagz.