Take the 2-minute tour ×

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.

    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">;

share|improve this question
add var_dump($_REQUEST['tagz']) to see waht that has in it. Do you not want $_GET or $_POST instead? –  Martin Lyne Nov 16 '12 at 0:18

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
+1 for mysqli/pdo. They will save you a ton of headaches from trying to figure out what to sanitize. –  Paronity Nov 16 '12 at 1:01

Your Answer


