I am trying to show something similar to related products on on my website. I have tested the following query, and I get no errors; but I get no results either.
<?php
$relatedStmt = $db->query("SELECT * FROM items WHERE tag LIKE id = 1 LIMIT 3");
?>
I also tried %1%
and it displayed ALL the results, I assumed the code was thinking the query was just SELECT * FROM items
.
The tags in the column are displayed in the following format: tagone two three four
, so I am trying to display the products that have similar tags, hence why I used the LIKE
clause.
The current query is to relate with this query: SELECT * FROM items WHERE id = 1
. So LIKE id = 1
is to find the tags that match this query to show the related products.