Reputation: 21
I am trying to create a search function for a client and they have a field in an existing table that they set up as a blob. When I query the table in my search script below I get the following results from three fields:
FIELDS:
1-item_num
2-info (blob)
3-name
Query:
$raw_results = mysql_query("SELECT * FROM store_products
WHERE (`item_num` LIKE '%".$query."%') OR (`info` LIKE '%".$query."%') OR (`name` LIKE '%".$query."%')") or die(mysql_error());
(RESULTS)
22 (name)
penlite (item_num)
PHA+MiBBQSBBbm9kaXplZCBBbHVtaW51bSBwZW5saXRlIDwvcD4= (info)
How do I convert the blob into readable text on my search results page?
Upvotes: 2
Views: 1260
Reputation: 105
You can use this query
$raw_results = mysql_query("SELECT * FROM store_products
WHERE (`item_num` LIKE '%".$query."%') OR (CONVERT(`info` USING utf8) LIKE '%".$query."%') OR (`name` LIKE '%".$query."%')") or die(mysql_error());
Upvotes: 1