Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP update query not working
    text
    copied!<p>As a task my teacher has given me (highschool year 10) to create a login form using html and php as we have just started to learn PHP i have made progress and this is my first attempt. I will go into more secure options later.</p> <pre><code>&lt;?PHP //Create the connection… //("where the database is", 'Database login' , 'database password' , "Database name") $con=mysqli_connect("", 'root', 'root', "Social"); //Check our connection… if (mysqli_connect_errno($con)) { echo " Sorry Mate"; } $username = $_POST[username]; $password = $_POST[pawd]; $result = mysqli_query($con, "SELECT * FROM User_info"); $row = mysqli_fetch_array($result); $value = $row['username']; if($value == "$username") { $result = mysqli_query($con, "SELECT * FROM User_info"); $row = mysqli_fetch_array($result); $value = $row['password']; if($value == "$password") { $sql=("UPDATE user_check SET user = '1' "); $sql=("UPDATE user_check SET name = '$username' "); header( 'Location: feed.php' ) ; } else { header( 'Location: social.php' ) ; } } else { header( 'Location: social.php' ) ; } if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } mysqli_close($con); ?&gt; </code></pre> <p>Where it says </p> <pre><code> $sql=("UPDATE user_check SET user = '1' "); $sql=("UPDATE user_check SET name = '$username' "); </code></pre> <p>The first one will work and update the database to 1 however the second one doesn't i have checked the name of the column changed the name of the variable $sql and $username and it still won't work is there any suggestions? Thankyou in advance :D</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload