-2

I'm not sure how to address this issue:

EDIT: can someone just edit my code with the corrections because this is due tmrw.

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\login\login-registration-php\login-registration-php-new\dbconnect.php:6 Stack trace: #0 C:\xampp\htdocs\login\login-registration-php\login-registration-php-new\index.php(4): require_once() #1 {main} thrown in C:\xampp\htdocs\login\login-registration-php\login-registration-php-new\dbconnect.php on line 6

    <?php

// this will avoid mysql_connect() deprecation error.
error_reporting( ~E_DEPRECATED & ~E_NOTICE );
// but I strongly suggest you to use PDO or MySQLi.
$conn = mysql_connect(localhost,nathan,password);
$dbcon = mysql_select_db(dbtest);

if ( !$conn ) {
    die("Connection failed : " . mysql_error());
}

if ( !$dbcon ) {
    die("Database Connection failed : " . mysql_error());
}
  • 2
    by moving forward to new libraries:- `mysqli_*` OR `PDO`:-https://prnt.sc/gubvir – Alive to die - Anant Oct 07 '17 at 07:18
  • Do some search on google you will get why there is an error. Don't post question without any effort – B. Desai Oct 07 '17 at 07:20
  • 2
    Possible duplicate of [Why shouldn't I use mysql\_\* functions in PHP?](https://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php) – B. Desai Oct 07 '17 at 07:22
  • `Don't post question without any effort` When pos(t)ing a question, show what effort you invested. (Show a bit of effort to get the error message formatted readably: add two trailing blanks to each line. In due time, digest the editing help.) – greybeard Oct 07 '17 at 08:44

1 Answers1

0

Please check extension=mysqli.so and extension=mysql.so both uncomment in your php.ini.

Jinesh
  • 1,554
  • 10
  • 15
  • what does that mean?- – MR Curri Nate Oct 07 '17 at 07:33
  • are you able to open phpmyadmin ? – Jinesh Oct 07 '17 at 07:37
  • please run phpinfo(); and post that. The mysql.so module is definitely not loaded. Do you have extension_dir = "/usr/lib/php/modules/" in php.ini? Does the file /usr/lib/php/modules/mysql.so exist? If so apache must be using a different php.ini than /etc/php/php.ini. You can see that in phpinfo. (Loaded Configuration File) – Jinesh Oct 07 '17 at 07:37