not inserting/updating tables with php

Asked by At

Im trying to insert a some data in the form (name, email ,password) but when i open my table in database , the data is not inserted .. any ideas ? really appreciate your help.

<?php

$link = mysqli_connect("localhost", "root" ,"","myDemo");


    if(mysqli_connect_error()){
        
        die("Failed to connect to database ");
    }

$query = "INSERT INTO 'users' ('name' , 'email' , 'password') VALUES ('john' , '[email protected]' , '123')";

mysqli_query($link,$query);

// below this line works fine which retrieve the first row in the table

$query = "SELECT * FROM users";

if($res = mysqli_query($link,$query)){
    
    $row = mysqli_fetch_array($res);
    echo "ID: " .$row['id']. "<br> Name: " .$row['name'] ."<br> Email: " . $row['email'] ."<br> Passwoord:" .$row['password'];
    
}
else echo "false";


?>

0 Answers