title: php: convert pdo content to mysqli
body: <p>I am using a nice piece of code to reorder db content using <a href="http://www.ssdtutorials.com/tutorials/title/sort-table-rows-jquery.html" rel="nofollow">drag and drop</a>. I can get it to work locally by enabling the PDO extension in the php.ini file but my hosting package (shared) does not allow PDO and MySQLi simultaneously. I am unfamiliar with PDO and I would appreciate any help in rewriting the following segment to work with MySQLi, if possible. 
  Thanks.</p>
  
  <pre><code>&lt;?php
  if (isset($_POST['orders'])) {
  
  } else {
      echo json_encode(array('error' =&gt; true));
  }
  
  $orders = explode('&amp;', $_POST['orders']);
  
  $array = array();
  
  foreach($orders as $item) {
      $item = explode('=', $item);
      $item = explode('_', $item[1]);
      $array[] = $item[1];
  }
  
  try {
  
      $objDb = new PDO('mysql:host=localhost;dbname=test', 'user', 'pw');
      $objDb-&gt;exec("SET CHARACTER SET utf8");
  
      foreach($array as $key =&gt; $value) {
          $key = $key + 1;
          $sql = "UPDATE `artwork` 
                 SET `listorder` = ?
                 WHERE `id` = ?";
                 echo $sql;
  
          $objDb-&gt;prepare($sql)-&gt;execute(array($key, $value));        
      }
  
      echo json_encode(array('error' =&gt; false));
  
  } catch(Exception $e) {
  
      echo json_encode(array('error' =&gt; true));
  
  }
  </code></pre>