0
<?php 
if($_SERVER['REQUEST_METHOD']=='GET'){
    require_once('dbConnect.php');
    $result = mysql_query("SELECT count(*) from TableName;");
    echo mysql_result($result, 0);
    mysqli_close($con);
}
?>

In the above code sample, I can see that require_once is using older values of the file "dbConnect.php". The login credentials present in dbConnect.php is of older values, and not the latest one I updated recently. I can see this in the error message. Please suggest how to overcome this error.

webgenius
  • 856
  • 3
  • 13
  • 30
  • 1
    Please dont use [the `mysql_` database extension](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php), it is deprecated (gone for ever in PHP7) Specially if you are just learning PHP, spend your energies learning the `PDO` database extensions. [Start here](http://php.net/manual/en/book.pdo.php) – RiggsFolly May 22 '16 at 12:55
  • Is this the complete code? – RiggsFolly May 22 '16 at 12:56
  • When you made the new version of `dbConnect.php` did you put it in a different directory OR do you have more than one of these in different directories. _I am guessing that the answer to one of these must be YES_ – RiggsFolly May 22 '16 at 12:57
  • what is your web server? apache, nginx? did you try restart web server? – Yuseferi May 22 '16 at 13:01
  • @RiggsFolly dbConnect.php is in the same directory as GetData.php – webgenius May 22 '16 at 13:35
  • Is the code you show called `GetData.php`? – RiggsFolly May 22 '16 at 13:36
  • Are you using any cacheing on the server that might be holding the old file contents? – RiggsFolly May 22 '16 at 13:37
  • @RiggsFolly Yes, the code snippet pasted above is GetData.php – webgenius May 22 '16 at 13:37
  • Are you using session for storing database users, password, db name etc? – Amit Ray May 22 '16 at 13:54
  • No, I'm not using session – webgenius May 22 '16 at 14:07
  • If you can, then try a simple test: put die('hello webgenius'); into dbConnect.php with new values, refresh the page and see if it fails with that message or not. – michaJlS May 22 '16 at 16:07

0 Answers0