19

How do I fatal error: uncaught mysqli_SQL_exception

 1 year ago
source link: https://www.codeproject.com/Questions/5331645/How-do-I-fatal-error-uncaught-mysqli-SQL-exception
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

See more:

Copy Code
Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'username'@'localhost' (using password: YES) in E:\New folder\htdocs\Online Property Sales System\Src\html\register.php:10 Stack trace: #0 E:\New folder\htdocs\Online Property Sales System\Src\html\register.php(10): mysqli->__construct('localhost', 'username', 'password', 'Property_Lanka') #1 {main} thrown in E:\New folder\htdocs\Online Property Sales System\Src\html\register.php on line 10



What I have tried:

Copy Code
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "Property_Lanka";

// Create connection
$conn = new mysqli('localhost','root','','Property_Lanka');
// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}

$sql = "INSERT INTO MyGuests (`fname`, `lname`, `Pass`, `mno`, `dob`, `email`)
VALUES('$fname','$lname','$pass','$mno','$dob','$email')";

if ($conn->query($sql) === TRUE) {
  echo "New record created successfully";
} else {
  echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
?>

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK