Comparing MySql data and arrays.


Posted on 16th Feb 2014 07:03 pm by admin

I have a mysql table set up like this:
idsubjectbodyuseriddatetimetags1blog subjectblog body111|29|20099|30|AMblog,site news,tech
when displaying the data i want to be able to add "?id=blog&tags=blog,tech" to the url to search for multiple tags.

i'm pretty close with this:
Code: if (isset($_GET['tags'])) {
$tags = addslashes($_GET['tags']);
$srchinfo = "WHERE tags IN ('$tags')";
};
$result = mysql_query("SELECT * FROM blogs $srchinfo ORDER BY id DESC LIMIT $offset, $rowsPerPage");
but, when using the url, it will only show up posts that have one of the tags.

For example:
Post1: site news, blog
Post2: blog
Post3: blog,site news

"?id=blog&tags=blog" Only shows Post2
"?id=blog&tags=site news, blog" Only shows Post1

Anyone know what to do?
Thank you.

No comments posted yet

Your Answer:

Login to answer
267 Like 54 Dislike
Previous forums Next forums
Other forums

how to use two buttons with php
hi i have one form. there are three fields which are to be filled by the user. and then there are tw

PO Release Strategy Issue
Hi Experts,

I am facing an issue related to PO release strategy. The details are-
<

scandir clients directory
hi,
how can i scandir the clients directory? i need a script that when i click a button it will u

IP question
ive got 2 ip addresses both global from same user how would i detect if they are local to each other

FTP Programs
Here is a list of commonly suggested FTP Programs to use:

FileZilla
SmartFTP
CuteFTP

Struct/union and scope problem!
HI all , I have
Code: in header.h typedef struct Node Link; /* ---------

recrawling
Can anyone suggest me how may i know a page is updated before it is being downloaded, so that i can

CHMOD script
Hi,

I need a script to read all files in a folder and set to 777.

Can anyone help out

Blocking video streaming
Hello everyone,

I post a message here because i didn't find any solution yet.
I just finis

Why does my php page download images over and over
Can anybody please explain to me why my php page keeps downloading the images and other items every

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash