0
私は自分のテーブルにあるものを更新しようとしていますが、更新をクリックするたびに何も起こりません。これは私が取り組んでいるプロジェクトのためのテーブルに直接更新されるはずですが、私はこれにラウンド・アンド・ラウンドを行っていますが、それを理解できないようです。PHPの更新クエリが更新されていない、または動作していない
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Admin</title>
</head>
<body>
<?php
$con = mysql_connect('localhost', 'root', '');
if(!$con){
die("can not connect: " . mysql_error());
}
mysql_select_db("ie_login", $con);
if(isset($_POST['update'])){
$UpdateQuery = "UPDATE users SET FirstName='$_POST[fName]'. LastName='$_POST[lName]'. Email='$_POST[email]'. UserName='$_POST[username]'. Faculty='$_POST[faculty]'. Unit='$_POST[unit]'. 'Day'='$_POST[day]'. 'Time'='$_POST[time]' WHERE UserName='$_POST[hidden]'";
mysql_query($UpdateQuery, $con);
};
$sql = "SELECT * FROM users";
$records = mysql_query($sql, $con);
echo "<table class=table table-bordered>
<tr>
<th scope=col class=info>User ID:</th>
<th scope=col class=info>First Name:</th>
<th scope=col class=info>Last Name:</th>
<th scope=col class=info>Email:</th>
<th scope=col class=info>Username:</th>
<th scope=col class=info>Faculty:</th>
<th scope=col class=info>Unit:</th>
<th scope=col class=info>Consultation 1:</th>
<th scope=col class=info>Time of Consultation 1:</th>
</tr>";
while($user = mysql_fetch_array($records)){
echo "<form method=post action=Admin2.php>";
echo "<tr>";
echo "<td>" . $user['UserID']."</td>";
echo "<td>" . "<input type=text name=fName value=" . $user['FirstName']. " </td>";
echo "<td>" . "<input type=text name=lName value=".$user['LastName'] . " </td>";
echo "<td>" . "<input type=email name=email value=" .$user['Email']. " </td>";
echo "<td>" . "<input type=text name=username value=" .$user['UserName'] . " </td>";
echo "<td>" . "<input type=text name=faculty value=" .$user['Faculty'] . " </td>";
echo "<td>" . "<input type=text name=unit value=" .$user['Unit'] . " </td>";
echo "<td>" . "<input type=text name=day value=" .$user['Day'] . " </td>";
echo "<td>" . "<input type=time name=time value=" .$user['Time'] . " </td>";
echo "<td>" . "<input type=hidden name=hidden value=" . $user['UserName'] . "</td>";
echo "<td>" . "<input type=submit name=update value=update" . " </td>";
echo "</form>";
}
echo "</table>";
mysql_close($con);
?>
</body>
</html>
は、あなたの更新クエリのクエリ – coder
をエコー試してみましたが、それはすべきではありません各変数の後のカンマはピリオドではありませんか? – CaptainQuint
@Lot私は私のansで更新クエリを編集しました。 – coder