我已经在这个网站上搜索了解决方案,但没有结果。我被困在以下问题上,我的代码在 'where 子句'错误中给出了 Unknown Colum 'member_id'。以前没听说过。。所以我现在有点困惑。
这是我的代码:
<?php
require("db.php");
$id = $_REQUEST['member_id'];
$result = mysql_query("SELECT * FROM members WHERE member_id = '$id'");
$test = mysql_fetch_array($result);
if (!$result)
{
die("Error: Data not found..");
}
$admin=$test['admin'] ;
$firstname=$test['firstname'] ;
$lastname=$test['lastname'] ;
$mail= $test['mail'] ;
$login=$test['login'] ;
$passwd=$test['passwd'] ;
if(isset($_POST['save']))
{
$admin_save = $_POST['admin'];
$firstname_save = $_POST['firstname'];
$lastname_save = $_POST['lastname'];
$mail_save = $_POST['mail'];
$login_save = $_POST['login'];
$passwd_save = md5($_POST['password']);
mysql_query("UPDATE lijst SET admin ='$admin_save',firstname ='$firstname_save',lastname ='$lastname_save', mail ='$mail_save', login ='$login_save',
passwd ='$passwd_save' WHERE member_id = '$id'")
or die(mysql_error());
echo "Saved!";
header("Location: main.php");
}
mysql_close($conn);
?>
表格 :
<form method="post">
<table>
<tr>
<td>Admin</td>
<td><input type="text" name="admin" class="text w_20" value="<?php echo $admin ?>"/></td>
</tr>
<tr>
<td>Voornaam</td>
<td><input type="text" name="firstname" class="text w_20" value="<?php echo $firstname ?>"/></td>
</tr>
<tr>
<td>Achternaam</td>
<td><input type="text" name="lastname" class="text w_20" value="<?php echo $lastname ?>"/></td>
</tr>
<tr>
<td>E-mail</td>
<td><input type="text" name="mail" class="text w_20" value="<?php echo $mail ?>"/></td>
</tr>
<tr>
<td>Gebruikersnaam</td>
<td><input type="text" name="login" class="text w_20" value="<?php echo $login ?>"/></td>
</tr>
<tr>
<td>Password</td>
<td><input type="text" name="passwd" class="text w_20" value="<?php echo $passwd ?>"/></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="save" value="update" /></td>
</tr>
</table>
</form>