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

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.