这是用户登录时的代码:
if (isset($_POST['login_user'])) {
$email = mysqli_real_escape_string($db, $_POST['Email']);
$password = mysqli_real_escape_string($db, $_POST['Password']);
if (empty($email)) {
array_push($errors, "email is required");
}
if (empty($password)) {
array_push($errors, "Password is required");
}
if (count($errors) == 0) {
$password = md5($password);
$query = "SELECT * FROM organisers WHERE email='$email' AND password='$password'";
$results = mysqli_query($db, $query);
if (mysqli_num_rows($results) == 1) {
$_SESSION['email'] = $email;
$_SESSION['success'] = "You are now logged in";
header('location: loggedInInterface/loggedIN.php');
}else {
array_push($errors, "Wrong email/password combination");
}
}
}
不用担心,我稍后会清理我的代码。
如您所见,他们将使用他们的电子邮件和密码登录。如何获取用户主键值?
注意:主键列名称=' organiserID'
答案 0 :(得分:1)
$行= mysqli_fetch_row($结果); echo $ row [organiserID];
答案 1 :(得分:0)
在您的' if'之后加入声明,然后您可以访问它:
opencv_world340d.lib
答案 2 :(得分:0)
$行= mysqli_fetch_assoc($结果); $ primaryKey = $ row [organiserID];
出于某种原因,你必须使用“mysqli_fetch_assoc”而不是使用“mysqli_fetch_row”。