vendredi 3 avril 2015

my "Edit Profile PHP code" doesn't work, what is wrong with the code?


Vote count:

-1




i tried to program a php code that allows the member to update his profile but somehow the code doesn't work.


the SELECT query select the member username from the database then check if he is in the database then fill the input with the updated info


but the code doesn't work!


here's my php code:



<?php

include_once("dbconnect/loginconnect.php");


if(isset($_POST['submit'])){
$fname = $_POST["firstname"];
$lname = $_POST["lastname"];
$email = $_POST["email"];
$pass = $_POST["password"];
$phone = $_POST["phone_number"];
$nationality = $_POST["nationality"];
$religion = $_POST["religion"];

if ($email && $fname && $lname && $pass && $phone && $nationality && $religion) {

$exists = mysql_query("SELECT * FROM members WHERE username='$username'") or die ("Could NOT!");

if (mysql_num_rows($exists) != 0 ) {
mysql_query ("UPDATE members SET email='$email' AND firstname='$fname' AND lastname='$lname' AND password='$pass' AND phone_number='$phone' AND nationality='$nationality' AND religion='$religion' WHERE username='$username'") or die ("Couldn't update");
echo "Your Information Has Been Updated!";
}
} echo "Please Insert all Fields!";
}


?>


and this is my html code:



<form action="editprofile.php" method="post">
<input type="text" name="username" value="<?php print("$session_username");?>" /><br/>
<input type="text" name="fname" placeholder="First Name" value="" /><br/>
<input type="text" name="lname" placeholder="Last Name" value="" /><br/>
<input type="text" name="email" placeholder="Email" value="" /><br/>
<input type="password" name="pass1" placeholder="Password" value="" /><br/>
<input type="phone_number" name="number" placeholder="Phone Number" value="" /><br/>
<input type="submit" value="Update!" method="post"/>
</form>


asked 35 secs ago







my "Edit Profile PHP code" doesn't work, what is wrong with the code?

Aucun commentaire:

Enregistrer un commentaire