Jump to content

Querying a MySQL "blob"


bluedot

Recommended Posts

Hi,

 

I have a search script that the user chooses to search under 1 of 3 columns (author, source, quote).

author and source are "varchar" columns, and if i choose one of those 2 to search in it works fine. However quote is a "blob" column as I allow some formating in this column. If i put a test row in the database with no formating in the quote column it can be found by the search just fine. But if there is any text that is formated can't be found.

Im guessing this is due to the way blobs are stored, so my question is how do I query it?

 

This is my current query:

<?php
$find = strtoupper($find);
$find = strip_tags($find);
$find = trim ($find); 
$data = mysql_query("SELECT * FROM quotes WHERE upper($conditions) LIKE'%$find%'", $hd);
?>

 

$find is what they searched for, and $conditions is where what column they wanted to search in.

 

Thank you.

Link to comment
https://forums.phpfreaks.com/topic/37687-querying-a-mysql-blob/
Share on other sites

try changing the field type to LONGTEXT instead of a blob. You should be able to have the same performance level w/o having to change any of your insert commands. This will also make the field fulltext so you should be able to search it. With blob, the encoding is different, thus not searchable w/o changing the encoding of your LIKE.

Link to comment
https://forums.phpfreaks.com/topic/37687-querying-a-mysql-blob/#findComment-180972
Share on other sites

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.