title: Database restore problem trigger and stored procedure (Mysql / Codeigniter)
body: <p>We are using single source with multiple database concept. I am trying to restore db(.sql file) to client database, all tables restore fine except trigger and stored procedure.</p>
  
  <h2>Our view</h2>
  
  <p><a href="https://i.stack.imgur.com/pPpvk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pPpvk.jpg" alt="enter image description here"></a></p>
  
  <h2>Controller</h2>
  
  <pre><code>public function import_database(){ 
  $data = $this-&gt;input-&gt;post();
          if(!empty($data)) 
              {
              $config_app = array(
              'hostname' =&gt; 'localhost',
              'username' =&gt; 'root',
              'password' =&gt; '',
              'database' =&gt; $data['cmp_db_name'],
              'dbdriver' =&gt; 'mysqli',
              'dbprefix' =&gt; '',
              'pconnect' =&gt; FALSE,
              'db_debug' =&gt; TRUE
              );
              $this-&gt;db =$this-&gt;load-&gt;database($config_app,TRUE); // open client database connection
                          $filename=$_FILES["database"]["tmp_name"];      
                          $templine = '';
  $lines = file($filename);
   foreach ($lines as $line)
  {
  if (substr($line, 0, 2) == '--' || $line == '')
  continue;
  $templine .= $line;
  if (substr(trim($line), -1) == ';')
  {
  $this-&gt;db-&gt;query($templine);
  $templine = '';
  }
  }
  }
  }
  </code></pre>
  
  <p>I got the following error:</p>
  
  <blockquote>
    <p>Error Number: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DELIMITER $$ CREATE DEFINER=root@localhost PROCEDURE audt_pro (IN coumn_n' at line 1 DELIMITER $$ CREATE DEFINER=root@localhost` PROCEDURE audt_pro (IN coumn_nm TEXT, IN deleted_id TEXT, IN tbl_nm VARCHAR(50)) BEGIN DECLARE qry text; </p>
  </blockquote>