question about field editing
Posted: Mon Aug 16, 2004 12:37 pm
what im trying to do is if the certain user (shown by $loggedin) is loggedin, they can edit their profile, but, i can grab all the info for them to edit it, but when they go to submit it doesnt change anything. so here is the code:
i thought that
you could makie it so, it grabs the for with the user = $loggedin (the user that is logged in) and only edit those fields (first, last, email, bio) but to no avail its not working. can anyone shed the light on this one.
thanks
edit i get this error also before i edit anything: ERROR :: You have an error in your SQL syntax near 'WHERE user= 'mroach' (first, last, email, bio) VALUES ('','','','','')' at line 1
Code: Select all
$result = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE user = '$loggedin'")) or die(mysql_error());
print "<form action="admin.php?action=edit" method="post">
<br>E-Mail: <input type="text" name="email" size="40" value="$result[email]">
<br>First Name: <input type="text" name="first" size="40" value="$result[first]">
<br>Last Name: <input type="text" name="last" size="40" value="$result[last]">
<br>Bio: <input type="text" name="bio" size="40" value="$result[bio]">
<input type="submit" value="Submit">
</form>";
$sql = "INSERT INTO users WHERE user= '$loggedin' (first, last, email, bio) VALUES ('','$first','$last','$email','$bio')";
$query = mysql_query($sql) or die ("ERROR :: " . mysql_error());
}Code: Select all
$sql = "INSERT INTO users WHERE user= '$loggedin' (first, last, email, bio) VALUES ('','$first','$last','$email','$bio')";thanks
edit i get this error also before i edit anything: ERROR :: You have an error in your SQL syntax near 'WHERE user= 'mroach' (first, last, email, bio) VALUES ('','','','','')' at line 1