java rocks java rocks - 1 year ago 74
MySQL Question

How to get Related result from mysql encoded string

I am encoding string using

$encodestr = base64_encode($str);
and store this string in a database. Now I want to search this string using
MATCH(title) AGAINST('$title')
but I can not get any result. I have stored many project titles in myself encoded form. Now if the user wants to search "funny product" then I have used
MATCH(title) AGAINST('$title')
for search it works before encoded but after encode it does not work.

Can anyone help me how to get the most related result using PHP and MySQL from an encoded string in myself?

I have used this query:

$titleTomatch = base64_encode($title);

$rel_query ="select v_id ,title,image_med_url,v_view, MATCH(title, des)
AGAINST('$titleTomatch') as score from v_data where MATCH(title,des)
AGAINST('$titleTomatch') or cat = '$cat' and block =0 and del =0 order by score desc limit 15";

Answer Source

So when you are matching a title against all encoded titles which are stored in db just encode your title then feed into sql.

$titleToMatch = base64_encode($title);

Then use query like MATCH(title ) AGAINST('$titleToMatch')

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download