【发布时间】:2015-05-05 06:44:21
【问题描述】:
我第一次在stackoverflow上发帖
如果通过 api 获取的 steamid 已经存在于“steamID64”列中,我想什么都不做。 但如果没有,请在同一列中插入新的 steamid
这是我的编码:
<?php
if(isset($_SESSION['steamid'])) {
include ('steamauth/userInfo.php'); //access steam informations
$ID64 = $steamprofile['steamid'];
$link = mysql_connect('xxx','xxx', 'xxx', 'xxx');
$query = "SELECT steamID64 FROM Users WHERE steamID64=".$ID64;
$result = mysql_query($query, $link);
$rowcount = mysql_num_rows($result);
if($rowcount == 0)
{
$newUser = "INSERT INTO Users SET steamID64='$ID64'";
mysql_query($newUser, $link);
mysql_free_result($result);
else
{
echo "User already exist"; //only for debug purpose
}
mysql_close($link);
}
?>
问题是他运行 else 但我的用户表是空的 那么我哪里错了? 0_o
我知道这个问题已经被问过了,但我已经尝试了所有我发现的东西
【问题讨论】: