PHP MYSQLI如果存在,则不会在if语句中重定向

时间:2019-06-19 19:32:48

标签: php mysql

在此程序中,我想将用户重定向到注册页面,如果尚未存储他们的SteamID,我将在其中插入信息。但是当我加载页面时什么都没发生吗?

MYSQLI数据文件:

<?php
$servername = "localhost";
$username = "usersAccount";
$password = "passwordExample";
$dbname = "theskindealer";
$mysqli = new mysqli($servername, $username, $password, $dbname);
?>

问题(重定向页):

<?php

error_reporting(E_ALL);

  session_start();

  include ('../steamauth/userInfo.php');
  require ('../../usersTable.php');
  require ('../steamauth/steamauth.php');

  $steamid = $steamprofile['steamid'];
  $email = "Not Set!";
  $name = $steamprofile['realname'];
  $profileURL = $steamprofile['profileurl'];
  $avatarIMG = $steamprofile['avatarmedium'];
  $profileName = $steamprofile['personaname'];
  $tradeURL = "Not Set!";
  $accessLevel = 1;
  $last_date = date("Y-m-d");
  $balance = 0;
  $ban = 0;
  $premium = 0;
  $tos = 0;

  $stmt_check = $conn->prepare("SELECT * FROM users WHERE steamid =?");
  $stmt_check->bind_param("s", $steamid);
  $stmt_check->execute();

  if($stmt_check->num_rows > 0){

    $stmt->close();
    $conn->close();

    header("Location: http://www.TheSkinDealer.com/scripts/update.php");

  } else {

    $stmt->close();
    $conn->close();

    header("Location: http://www.TheSkinDealer.com/scripts/register.php");

  }

?>

根本没有错误消息,只是一块空白的画布!

0 个答案:

没有答案