Database Connect error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Database Connect error

Kindly Tell me why I am seeing this error <?php if(!mysql_connect('localhost','root','') || !mysql_select_db('bankman_db')) { $error='Cant connect'; die($error); } ?> Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\BAnk2\server_connect.inc.php:2 Stack trace: #0 C:\xampp\htdocs\BAnk2\home.php(9): require() #1 {main} thrown in C:\xampp\htdocs\BAnk2\server_connect.inc.php on line 2

13th Apr 2020, 6:33 AM
Muhammad Asfand Yar
Muhammad Asfand Yar - avatar
1 Answer
+ 1
Try to change mysql_connect -> mysqli_connect mysql_select_db -> mysqli_select_db I don't know for sure but it seems you are using an obsolete code example, mysql_ had been replaced with mysqli_ Just try to replace any 'mysql_' with 'mysqli_' in your pages, *maybe* that is the problem.
13th Apr 2020, 7:01 AM
Ipang