Skip to content
Advertisement

why can’t I connect to mysql with uwamp,

/* Please input your sql-connection correctly

Made by Nitti
*/

$sqlHost = 'localhost';
$sqlUser = 'root';
$sqlPass = '';

// Please don't change anything below
mysql_connect($sqlHost, $sqlUser, $sqlPass) or die('Could not connect to the mysqlserver ('.mysql_error().')');

mysql_select_db('db_nit')
;

and as a result

Fatal error: Call to undefined function mysql_connect() in C:UwAmpwwwadminphpconnectDb.php on line 13

I’m using `

Apache 2.2.24 (with SSL) MySQL 5.6.11 PHP (5.3.25 / 5.4.15) with Xdebug 2.2.0 PHPMyAdmin 4.0.2

`

Advertisement

Answer

mysql_* functions were deprecated and will then removed from PHP. You need to use the mysqli_* functions or PDO for database operations now.

See PDO manual: http://php.net/manual/en/book.pdo.php

See mysqli manual: http://php.net/manual/en/book.mysqli.php

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement