Jump to content

[SOLVED] tag search problem


quickstopman

Recommended Posts

hey guys

im currently working on a blog system with tags

i get how it all works

but what i don't get is how you scan a mysql_query string

to see if it contains something

so for the search page

i want it to show all the blog entries that have

"bobber" in the tags

here is the code:

<?php
include("header.html");
if(isset($_GET['tag'])) {
$sql = mysql_query("SELECT * FROM blogs WHERE tags = '{$_GET['tag']}'") or die(mysql_error());
while ($r = mysql_fetch_array($sql)) {
echo $r['title'] ."<br>";
}
}
include("footer.html");
?>>

any one know??

thanks

Link to comment
https://forums.phpfreaks.com/topic/79651-solved-tag-search-problem/
Share on other sites

I don't really understand you since you have the code there already to search for an exact comparison.

 

If you're talking about looking for not an exact match, then you can use "LIKE" or REGEXP:

 

http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html#operator_like

 

http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html#operator_regexp

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.