mysql - SQL not connecting via php -
i have activated iis7 on windows 7 pc.
have installed php , mysql
i running following php code via localhost create d'base namely 'my_files.'
<?php error_reporting(e_all); ini_set('display_errors', true); $con=mysqli_connect("127.0.0.1", "root", "pass"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } // create database $sql="create database my_files"; if (mysqli_query($con,$sql)) { echo "database my_db created successfully"; } else { echo "error creating database: " . mysqli_error($con); } ?>
this error: "fatal error: call undefined function mysqli_connect() in c:\inetpub\wwwroot\db.php on line 4".
(other php codes running fine.) may problem , solution?
given error (undefined function) mysqli interface either not enabled in php.ini file or can't loaded ready.
look in php.ini file line:
extension=php_mysqli.dll
make sure not commented out. if was, un-comment , restart web server.
if turned on in php ini try figure out why can't load (check logs , google, etc).
you can create trival page:
<?php echo phpinfo(); ?>
and show of enabled extensions. after enable mysqli, open page , search mysqli find out if loaded ok.
Comments
Post a Comment