0

Please i need help to connect to database using xampp and php...

<?php mysql_connect('localhost', 'root', ''); mysql_select_db ('') ?> if I use this to connect it does not work. please what might be the problem... and if there is any other way to connect, please help..

17th Mar 2017, 1:38 PM
Prince Debrah
Prince Debrah - avatar
8 Respuestas
+ 6
Make sure MySQL is up and running on localhost.
17th Mar 2017, 1:45 PM
James Flanders
+ 6
You do not have the required extension. Uncomment the line extension=php_mysql.dll in your "php.ini" file and restart XAMPP.
17th Mar 2017, 2:00 PM
James Flanders
+ 4
What error do you get?
17th Mar 2017, 1:49 PM
James Flanders
0
it is running but still can't connect
17th Mar 2017, 1:48 PM
Prince Debrah
Prince Debrah - avatar
0
Fatal error: Uncaught Error:Call to undefined function mysql_connect() in C:\xampp\htdocs\php\connect.php:6 Stack trace:#0 {main} thrown in C:\xampp\htdocs\php\connect.php on line 6. this is the whole error msg
17th Mar 2017, 1:55 PM
Prince Debrah
Prince Debrah - avatar
0
use mysqli query <?php $con=mysqli_connect("localhost","my_user","my_password","my_db"); // Check connection if (mysqli_connect_error())   {   echo "Failed to connect to MySQL: " . mysqli_connect_error();   }
17th Mar 2017, 4:02 PM
Aung Aung
Aung Aung - avatar
0
fjcf
30th Dec 2017, 6:08 AM
Svilen mitov
0
cnef
30th Dec 2017, 6:09 AM
Svilen mitov