我正在尝试将用户名/密码发布到 PHP 文件中,以便我可以使用这些详细信息从用户表inner join
中获取uid -(用户 id) 。我在命令的子句中用作payid表的标识符。它不工作。有人可以告诉我哪里出错了吗?WHERE
INSERT
if(isset($_POST['password']) && isset($_POST['username']) && isset($_POST['rates'])) {
$con = mysql_connect("localhost","root","");
if (!$con) {
die ("Could not connect: " . mysql_error());
} else{
mysql_select_db("council", $con);
$result = mysql_query('SELECT pid FROM payid INNER JOIN user ON user.uid = payid.uid WHERE user.username = " $_POST[username]" AND user.password =" $_POST[password] "');
$pid = $result['pid'];
if(isset($pid))
$result = mysql_query("INSERT INTO fees (rates, pid) VALUES ('$rates', '$pid')");
if(!$row = mysql_fetch_array($result)) {
echo "<div id='t'>Invalid details please try again - use back arrow to return to form. </div>";
header ("Location: domRates.html");
}
if($row = mysql_fetch_array($result)) {
header ("Location: services.html");
}
}
mysql_close($con);