如果 MySQL 中的行数
可能的重复:
如何在 PHP 中获取有用的错误消息?
试图阻止用户作弊,当用户购买商品时,它会将其从数据库中删除,并且每次都会有一个 id。
因此,我制作了一个脚本,以便当用户购买商品时会将其从数据库中删除。所以现在我尝试选择查看 id 是否仍在数据库中(如果不是),则关闭页面以阻止用户作弊并再次获取该项目。
但我得到了一个白页,我想我可能在某个地方丢失了 [ 或 ] 。
$sql11 = "SELECT id FROM sell WHERE id ='"$idofpokemonsell"' ";
$result11 = mysql_query($sql11);
if (mysql_num_rows($result11)==0) {
echo "Cheater Reported";
die
}
我在此基础上开始连接和会话。其余的脚本都可以在这个页面上运行,但不是这个。
我在这里修复了工作代码,
$sql11 = "SELECT id FROM sell WHERE id ='$idofpokemonsell' ";
$result11 = mysql_query($sql11);
if (mysql_num_rows($result11)==0) {
echo "Cheater Reported";
die;
}
以防万一有人需要它。我错过了一个;死后我也把 $idofpokemonsell 放在“”一侧,但应该放在“”一侧
Possible Duplicate:
How to get useful error messages in PHP?
I'm trying to stop users cheating by when a user buys a item it removes it from the database and each time has an id.
So I have made a script so when a user buys an item it removes it from the db. So now I'm trying to select to see if the id is still in the db if not die the page to stop the user cheating and getting the item again.
But I'm getting a white page I think I might be missing a [ or a ] some where.
$sql11 = "SELECT id FROM sell WHERE id ='"$idofpokemonsell"' ";
$result11 = mysql_query($sql11);
if (mysql_num_rows($result11)==0) {
echo "Cheater Reported";
die
}
I have the connect and session start on top of this. And the rest of the scripts works on this page just not this.
I fixed it here is working code
$sql11 = "SELECT id FROM sell WHERE id ='$idofpokemonsell' ";
$result11 = mysql_query($sql11);
if (mysql_num_rows($result11)==0) {
echo "Cheater Reported";
die;
}
Just in case anyone need it . I missed a ; after the die also i put $idofpokemonsell in side "" but should of just been in side ''
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
进入 php.ini 并设置为 On this :
这会对您有很大帮助;)
Go into php.ini and set to On this :
It will help you a lot ;)
tail -f /path/to/apachelogs
然后刷新你的页面&查看日志,PHP 会在那里吐出错误。
tail -f /path/to/apache logs
Then refresh your page & watch logs, PHP will spit its errors there.