0

I've a Mysql db table column which name is notesUpdate. In this column data are contain like this:

$string = "{ASUSIBBIR}09-27-2014 19:38 PM alex : hmm..{ASUSIBBIR}{ASUSIBBIR}09-27-2014 20:04  
PM alex : note here..{ASUSIBBIR}{ASUSIBBIR}

Now I want to search in this column using sql query. I'm using following queryto search..

$getSearch = "my join query............";
if($ad_noteterm){    
    $getSearch .= "AND LOCATE('$ad_noteterm', cd.notesUpdate)"; 
}

Using this query I can get result but problem is I want to search without following Text..

{ASUSIBBIR}09-27-2014 19:38 PM alex :

So Search result should be hmm.. or note here if i search on it. I've no idea what is the Sql query should be ?

Without db table column I can search to string using following regular expression..

$match[0] = '/\{ASUSIBBIR\}(.+?)\s:\s/';
$match[1] = '/\{ASUSIBBIRsss\}/';
$haystack = preg_replace($match, '', $string); 

BUT HOW CAN I USE THIS IN SQL QUERY TO GET THE RESULT ?

Thank You!!

Shibbir
  • 257
  • 4
  • 24
  • Consider changing your database design and storing different things in different columns instead of creating one big blob of text that you have to search through and split later. – fsperrle Oct 03 '14 at 16:02
  • @Fabian your idea is good. But Is there any way to search in this situation ? – Shibbir Oct 03 '14 at 16:05

0 Answers0