title: Warning: mysql_query(): 7 is not a valid MySQL-Link resource
body: <p>Similar questions to this my have been asked a lot of times before. But since I did not find a solution in any of the questions asked before me, I take the liberty of asking it again.</p>
  
  <p>My program uses a class made by me which handles all database connections for the program. Several modules I've used before used the same class without fail but when I chose to do a new module using the same class, the warning shows as- </p>
  
  <p>Warning: mysql_query(): 7 is not a valid MySQL-Link resource in <em>wherever...</em> on line 49.</p>
  
  <p>The warning happens when I execute a MySQL query through a function I made. The function is as follows-</p>
  
  <pre><code>public function runquery($_query)
  {
    $result = mysql_query($_query,$this -&gt; connection); //line 49
    if (! $result) die(mysql_error());
    else return $result;
  }
  </code></pre>
  
  <p>The function belongs to a class named <code>mysql</code> and it has not been tampered with or made changes to. So the function should technically work as expected, as every other module relying on the same class for database connectivity works just fine.</p>
  
  <p>The query execution is successful however and I manage to update tables with no problems (except the warning). The block of code in the main program where the <code>runquery()</code> function is called from is as follows-</p>
  
  <pre><code>$phpmyadmin = new mysql();
  $phpmyadmin-&gt;connect('localhost', 'root', '');
  $phpmyadmin-&gt;setdb('test_db');
  $result = $phpmyadmin-&gt;runquery($Query);
  unset($phpmyadmin);
  </code></pre>
  
  <p>So the <code>mysql</code>'s functions work just as fine as ever and the query executes just fine. But the warning shows for a reason I cannot understand. Any help?</p>