THE SQL WHERE funtion does not work!
我尝试了一切,但这段代码不起作用, 请帮帮我。
我想重建steamcompanion.com。
<?php
include 'SteamAuth/SteamConfig.php';
echo 'db.php connected;
$fruit1 = "localhost";
$fruit2 = "";
$fruit3 = "";
$fruit4 = "";
$conn = new mysqli($fruit1, $fruit2, $fruit3, $fruit4);
$steamid = $steamprofile['steamid'];
$sql = "SELECT * FROM users WHERE steamid = '$steamid'"; //DOES NOT WORK //$sql = "SELECT * FROM users WHERE steamid = $steamid"; does not work too!
if ($conn->query($sql) === TRUE) {
echo '<meta http-equiv="refresh" content="0; URL=http://mynameisflare.rf.gd/">YOU ARE LOGGEDIN!!';
exit;
} else {
$profileurl = $steamprofile['profileurl'];
$avatarmed = $steamprofile['avatarmedium'];
$avatarfull = $steamprofile['avatarfull'];
$peronaname = $steamprofile['personaname'];
$realname = $steamprofile['realname'];
$sql = "INSERT INTO users (id, name, email, profileurl, avatarmedium, avatarfull, steamid, realname, makes, wins)
VALUES ('', '$peronaname', 'PLEASE PROVIDE A EMAIL!', '$profileurl', '$avatarmed', '$avatarfull', '$steamid', '$realname', '0', '0')";
if ($conn->query($sql) === TRUE) {
echo '<meta http-equiv="refresh" content="0; URL=http://mynameisflare.rf.gd/">REDIRECTING YOU!';
exit;
}
}
$conn->close();
?>
&#13;
SQL WHERE功能不起作用!
echo $ sql的结果,SELECT * FROM users WHERE steamid = 76561198173691810
答案 0 :(得分:-1)
首先检查您的连接。更多详情http://php.net/manual/en/mysqli.affected-rows.php
Note that enabling ProGuard takes build time much more than normal build time.So better to do it before release of your app.
如果steamid是数字列,则无需为此数字使用单引号。
现在用/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
检查您的$ steamid是否获得号码。
对于成功的SELECT,SHOW,DESCRIBE或EXPLAIN查询,mysqli_query()将返回一个mysqli_result对象,而不是boolean。但是你正在检查echo $sql
这意味着返回值是布尔值,这是不正确的。
希望通过这些方式排除故障。