title: How do I use mb_substr to fetch data?
body: <p>I can use <code>mb_substr</code> in PHP and get part of string,my problem is I want to use this function in MySQL and get part of field data, I don't want to use <code>foreach</code> to get part of that.</p>
  
  <p>I want to use this function in this below code.</p>
  
  <p><code>subject</code> is 500 char and I want to get 150 char from that and my database is <code>UTF-8</code> and my storage engine is MyISAM.</p>
  
  <pre><code>        $allContents = $db-&gt;loadAssoc( $db-&gt;setQuery("SELECT id , subject FROM contents ;") );
          if ( $allContents ){
              $data['success'] = true;
              $data['message'] = $allContents; 
          }
          else{
              $data['success'] = false;
          }
  </code></pre>
  
  <p>I don't like to use this method:</p>
  
  <pre><code>$arr = array();
  foreach ( $allContents as $value )
  {
     $topic['id']      = $value['id'];
     $topic['subject'] = mb_substr($value['subject'],0,150,'UTF-8').' ... ';
     $arr = $topic ;
  }
  </code></pre>
  
  <p>Can I use <code>substr</code> in MySQL like this code?</p>