title: Check to see if tuple data exists in database before insert
body: <p>I am trying to check if tuple data exists before entering the data into the database columns. I am trying mysql_query and getting errors that I should be using mysqli, but it does not seem to be working for me.</p>
  
  <p>This is my code so far</p>
  
  <pre><code>foreach ($AllData as $sigleData) {
      $table = $sigleData['name'];
      $columns = implode(", ", $sigleData['columns']);
      $columnData = implode(" ',' ", $sigleData['data']);
  
      //insert into database tuple data       
      $sqlQuery = "INSERT INTO " . $table . " ( " . $columns . ") VALUES( '" . $columnData . "')";
  
      if ($dbConnectionT-&gt;query($sqlQuery) == TRUE) {
          echo "database updated";
          echo "&lt;/br&gt;";
      }
  }
  </code></pre>
  
  <p>I have this function :- </p>
  
  <pre><code>        function check_tuple_exists($table){
          global $dbConnectionT; // connection to database
          $sql = "SELECT ALL FROM '".$table."'";
          $res = $dbConnectionT-&gt;query($sql);
          if ($res-&gt;num_rows &gt; 0) 
          {   // output data of each row
              while($row = $res-&gt;fetch_assoc()) {
              echo "data " . $columnData . "&lt;br&gt;";
              }
          } else 
                  {
                      echo "0 results";
                  }       
  
          }
  </code></pre>
  
  <p>but it gives me this error:-
  Trying to get property of non-object </p>