-1

I try to connect my php script with my localhost server.

I asked classmates, but they don't know where the problem can be either.

This is the error code:

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\wamp64\www\serveranbindung.php on line 8

( ! ) Error: Call to undefined function mysql_connect() in C:\wamp64\www\serveranbindung.php on line 8

My script is this one

  <?php
      $servername="localhost";
      $username="root";
      $password="";
      $db="test";

      $conn=mysqli_connect($servername, $username, $password, $db);

      if ($conn) {
        echo "Connection success";
      }else {
        echo "Connection not success";
      }
     ?>

Do you have an idea where the mistake could be?

Your Common Sense
  • 154,967
  • 38
  • 205
  • 325
Fa Le
  • 1
  • 1
  • 4
  • Please update your question with `mysqli_error($conn)`'s output so we can help you. – Alexander Santos Jan 03 '20 at 16:51
  • i update my question – Fa Le Jan 03 '20 at 16:58
  • Is the script at the error your script? – Alexander Santos Jan 03 '20 at 17:18
  • yes thats my script. but where is the mistake? For me the script is correct... – Fa Le Jan 03 '20 at 17:31
  • This is not the script which throws the error. – Dharman Jan 03 '20 at 17:53
  • try this https://stackoverflow.com/questions/34579099/fatal-error-uncaught-error-call-to-undefined-function-mysql-connect https://stackoverflow.com/questions/10615436/fatal-error-call-to-undefined-function-mysql-connect https://stackoverflow.com/questions/46886545/uncaught-error-call-to-undefined-function-mysql-connect-duplicate-online-err – Nizomiddin Zaripov Jan 03 '20 at 18:51
  • from what I understand, you are not able to authenticate?? If so, try running 'sudo mysql_secure_installation' in your terminal – William Jan 03 '20 at 18:53
  • Does this answer your question? [Fatal error: Uncaught Error: Call to undefined function mysql\_connect()](https://stackoverflow.com/questions/34579099/fatal-error-uncaught-error-call-to-undefined-function-mysql-connect) – Dharman Jan 03 '20 at 19:10

1 Answers1

-1

use mysqli_connect in serveranbindung.php and check the database credentials is correct

smileraj
  • 1
  • 3