CodeAndCoins Forum

Official Forum of YouTube/CodeAndCoins Channel

Any problem, other than on a youtube video.
#57
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.

<?php
$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;
}
$conn->close();
?>
#67
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
XEvil 5.0 killed Cryptocurrency!

https://b.radikal.ru/b20/2105/32/349fa756d3a4.jpg[…]

XEvil can solve ANY Captcha..

https://a.radikal.ru/a32/2105/f6/9e1ffaab7d9d.png[…]

https://b.radikal.ru/b20/2105/32/349fa756d3a4.jpg[…]

https://c.radikal.ru/c00/2105/69/b9fa6bd185a9.jpg[…]