title: Codeigniter active record where() with serialize data and regex
body: <p>i want to fetch all the records against a specific user_id, in my table user data is in serialize form in a column (user_data).</p>
  
  <pre><code>a:9:{s:9:"auth_type";s:4:"user";s:7:"user_id";s:2:"40";s:9:"user_type";s:1:"2";s:5:"fname";s:9:"Saif Alvi";s:5:"sname";s:0:"";s:8:"nickname";s:8:"saifalvi";s:6:"gender";s:0:"";s:13:"user_type_str";s:8:"employer";s:7:"lang_id";s:1:"1";}
  </code></pre>
  
  <p>to fetch all records against user_id i am using below query</p>
  
  <pre><code>$result = $this-&gt;DB-&gt;select("COUNT(*) AS sessionCount")-&gt;from(SESSIONS_TABLE)-&gt;where('user_data', REGEXP.'s:7:"user_id";s:"^[0-9]+":'.'"$user_id"')-&gt;get()-&gt;result_array();
  </code></pre>
  
  <p>where i am wrong or any other solution to use codigniter active record where() with serialize data and regex    </p>