CodeAndCoins Forum

Official Forum of YouTube/CodeAndCoins Channel

Any problem, other than on a youtube video.
Warning: mysqli::__construct(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO) in C:\wamp64\www\clinic\insert.php on line 8
This is my coding.

$servername = "localhost";
$username = "root";
$password = "";
$dbname = "clinic";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("connection failed: " . $conn->connect_error);

$patient_id = $_POST['txt_patientid'];
$patient_name = $_POST['txt_patientname'];
$address = $_POST['txt_address'];
$treatment= $_POST['txt_treatment'];
$email = $_POST['txt_email'];
$telephone_no = $_POST['txt_telephoneno'];

$sql = "INSERT INTO tbl_registration (patient_id, patient_name, address, treatment, email, telephone_no) VALUES('$patient_id', '$patient_name','$address', '$treatment', '$email', '$telephone')";

if ($conn->query($sql) === TRUE) {
$last_id = $conn->insert_id;
echo "New record created successfully. Last inserted ID is: " . $last_id;
} else

echo "Error: " . $sql . "<br>" . $conn->error;
sorry, can I ask one last question? why this error occurs?

Fatal error: Uncaught Error: Call to undefined function mysql_error() in C:\wamp64\www\clinic\afterupdate.php on line 34

echo "Query Failed: " . mysql_error(); <- this is line 34


Warning: mysqli::__construct(): (HY000/1045): Acce[…]

How to get the data from Register into Login

Check out this post .

Checking values in a database

Good day, I have an IOT device where I check t[…]