Hiy guys alot of you have been brilliant over the past few days. I'm creating my own website and I want to let users register and log in, into the site
I'm now getting this error message
Warning: mysqli_query(): Couldn't fetch mysqli in C:\xampp\htdocs\submit-form.php on line 19
The following SQL Failed INSERT INTO 'users' (firstname
, lastname
, username
, confirmusername
, password
, confirmpassword
, email
,confirmemail
) VALUES ('richard', 'Hemmings', 'hemmo001', 'password', 'password', 'richardgwhemmings@msn.com' , 'richardgwhemmings@msn.com')
<?php
//select your database
//$b=mysql_select_db("database_name",$a);
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$username=$_POST['username'];
//$confirmusername=$_POST['confirmusername'];
$password=$_POST['password'];
$confirmpassword=$_POST['confirmpassword'];
$email=$_POST['email'];
$confirmemail=$_POST['confirmemail'];
//Database connection
require_once("config.php");
//mysql query to insert value to database
$query="INSERT INTO 'users' (`firstname`, `lastname`, `username`, `confirmusername`, `password`, `confirmpassword`, `email` ,`confirmemail`) VALUES ('$firstname', '$lastname', '$username', '$password', '$confirmpassword', '$email' , '$confirmemail')";
$result = mysqli_query($connection,$query);
//if value inserted successyully disply success message
if(!$result) {
die("The following SQL Failed $query");
}
echo 'Registred successfully..!!</div>';
?>
I've been looking at it all day now and I just need some advice