0

This is shown on browser

Fatal error: Uncaught ArgumentCountError: mysqli_connect_errno() expects exactly 0 arguments, 1 given in C:\xampp\htdocs\Sports-Club-Management-System-master\Files\include\db_conn.php:11 Stack trace: #0 C:\xampp\htdocs\Sports-Club-Management-System-master\Files\include\db_conn.php(11): mysqli_connect_errno(Object(mysqli)) #1 C:\xampp\htdocs\Sports-Club-Management-System-master\Files\secure_login.php(3): include('C:\\xampp\\htdocs...') #2 {main} thrown in C:\xampp\htdocs\Sports-Club-Management-System-master\Files\include\db_conn.php on line 11

And this is my code on line 11 in db_conn

con = mysqli_connect($host, $username, $password, $db_name);

// Check connection
if (mysqli_connect_errno($con)) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

I would be more than happy for someone to see the whole project throughout to help me fix the problem, since I dont think it ends here, fingers crossed

  • Remove all this code and enable mysqli error reporting – Dharman Mar 16 '22 at 21:41
  • It looks like you are using some really bad tutorial. I highly encourage you to find something better. If you are only starting to learn PHP then you should learn PDO instead of mysqli. PDO is much easier and more suitable for beginners. Start here https://phpdelusions.net/pdo & https://websitebeaver.com/php-pdo-prepared-statements-to-prevent-sql-injection. Here are some good video tutorials https://youtu.be/2eebptXfEvw & https://www.youtube.com/watch?v=sVbEyFZKgqk&list=PLr3d3QYzkw2xabQRUpcZ_IBk9W50M9pe- – Dharman Mar 16 '22 at 21:41
  • `con = mysqli_connect($host, $username, $password, $db_name);` missing `$` before `con` – Honk der Hase Mar 16 '22 at 23:28

0 Answers0