$tag = $_GET[tag];
$search = mysql_query("SELECT * FROM `threads` WHERE FIND_IN_SET('$tag', `tag`) = '$tag'");

why is this returning all of the rows in the table they all do not have the same tags none of them have the same tags as each other yet
the column name is tag.
the search term is $tag in the url (hence the get)
please i do not understanddddddddddd help!?

and then i tried taking the = '$tag' part out and well.... its not working... at all. even tho the tag matches one of the rows tag feild.. it comes up NOTHING.

The FIND_IN_SET function is used to search a list of strings for a specific string. I don't think you need to do this. Your query should look something like this I think:

$tag = $_GET[tag];
// NEED TO PERFORM SOME DATA CHECKS HERE...
$search = mysql_query("SELECT * FROM threads WHERE tag = '$tag'");

yeah im actually using like %tag% but i dont know any other way to do it. which really bothers me its not too precise. like if i search for e, everything with an e in it comes up not things that are specifically tagged e.

$tag = $_GET[tag];
$search = mysql_query("SELECT * FROM `threads` WHERE FIND_IN_SET('$tag', `tag`) >0");

does the tag field contain one tag eg blue
or do you have multiple tags in it eg blue, sky, clouds

If it's the second one, start by redesigning your database! Because the second means you have to rebuild it and have a threads table and a tagged table
thread---<tagged
where tagged contains thread id and the actual tag.

If it was the second one, your database is not even in first normal form. And hence you are doomed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.