0
<?php

mysql_connect("localhost","root","");

mysql_select_db("univ_management");

?>

this is the following block of the code

Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\ums4\db_con.php:2 Stack trace: #0 C:\xampp\htdocs\ums4\action.php(10): include_once() #1 {main} thrown in C:\xampp\htdocs\ums4\db_con.php on line 2

  • 5
    the `mysql_` api is deprecated and has been removed since php7. Check your php version. In any event, you should prefer `mysqli` or `PDO` – YvesLeBorg Jan 18 '19 at 02:49

1 Answers1

0

First and foremost: do not use mysql_* functions. Just don't, there is no excuse. These have long since been deprecated (with good reason). Instead, use the mysqli_* functions (note the i) or the PDO library. With that out of the way, an actual answer to your question:

Though dense, the error message describes exactly the problem:

... Call to undefined function mysql_connect() ...

This implies that PHP is missing the appropriate shared library that might define that function. Given the currently supported versions of PHP, I suspect you are using PHP7+. This is important because the mysql_* functions were removed in PHP v7.0.0.

hunteke
  • 3,474
  • 1
  • 5
  • 15