title: Re-writing code - does not function
body: <p>I'm trying to rewrite an existing code CODE 1 using mysqli functions (CODE 2). But it's not working. Could someone help rectify this problem?</p>
  
  <p>CODE 1 (old code - works)</p>
  
  <pre><code>&lt;?php
  if(isset($_POST['thename']) === true &amp;&amp; empty($_POST['thename']) === false) {
      require'../db/connection.php';
  
      $query = ("SELECT 'photos'.'theurl' FROM 'photos' WHERE 'photos'.'thename' = '" . mysql_real_escape_string(trim($_POST['thename'])) . "'");
  
      echo(mysql_num_rows($query) !== 0) ? mysql_result($query, 0, 'theurl') : 'Not found';
  </code></pre>
  
  <p>CODE 2 (new - not working)</p>
  
  <pre><code>&lt;?php
  if(isset($_POST['thename']) === true &amp;&amp; empty($_POST['thename']) === false) {
      $getVal = mysqli_real_escape_string($Conn_db, trim($_POST['thename']));
  
      require_once('../db/connection.php');
      $query = ("SELECT 'photos'.'theurl' FROM 'photos' WHERE 'photos'.'thename' = '" . $getVal . "'");
      $result = mysqli_query($Conn_db, $query);
  
      $queryA = ("SELECT id FROM photos");
      $resultA = mysqli_query($Conn_db, $queryA);
      $row_cnt = $resultA-&gt;num_rows;
  
      echo($row_cnt !== 0) ? mysqli_result($result, '0', 'theurl') : 'Not found.';
  } 
  
  function mysqli_result($result, $ro, $field) { 
      $result-&gt;data_seek($ro); 
      $datarow = $result-&gt;fetch_array(); 
      return $datarow[$field]; 
  }
  </code></pre>