I've been spending the last hour trying to research why my SQL will not update to my database with INSERT INTO. I have tried to do my research as to why it is not working but have not come up with an answer.
Some things I have tried are:
Echoing the $query variable to make sure everything is printing to mysqli_query as wanted
Making sure the database is responsive (i can fetch info just not add info)
Trying with accents and without `
Double checking my typos
Is this something obvious or have I just not stumbled upon my error yet?
<?php
$link = mysqli_connect("localhost", "cl14-users-q36", "********", "cl14-users-q36");
if (mysqli_connect_error()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$query = "INSERT INTO `users`(`id`, `email`, `password`) VALUES(`3`, `new@yahoo.com`, `password`)";
mysqli_query($link, $query);
$query = "SELECT * FROM users";
if ($result = mysqli_query($link, $query)) {
$row = mysqli_fetch_array($result);
print_r($row);
echo "Your email is ".$row[1]." and your password is ".$row[2]."!";
}
?>