PHP Mysql - MySQL_Query命令未运行


PHP Mysql - MySQL_Query command not running

不知道为什么,但这行甚至没有给出错误,它根本不运行,并且在运行后也会停止任何代码。我已经用 die("check") 检查了语句的任何一侧,并且只在之前运行。

mysql_query("UPDATE rounds 
             SET `active`='0', `winnerusername`='$WinnerUsername', `winnerid`='$WinnerID', `pot`='$PreviousPot', `paid`='1' 
             WHERE `round`='$CurrentRound' ") or die(mysql_error());

知道为什么它不会运行吗?

将其更改为

mysql_query(
  "UPDATE rounds SET `active`='0',
       `winnerusername`='".$WinnerUsername."', 
       `winnerid`='".$WinnerID."', 
       `pot`='".$PreviousPot."', 
       `paid`='1' 
   WHERE `round`='".$CurrentRound."' "
) or die(mysql_error());

试试这个:

$sql="UPDATE rounds SET active='0', winnerusername='".$WinnerUsername."', winnerid='".$WinnerID."', pot='".$PreviousPot."', paid='1' WHERE round='".$CurrentRound."' ";
$rs=mysql_query($sql,$Your_Connection_String);

$Your_Connection_String是这样的:

$Your_Connection_String=mysql_connect("localhost","username","password");
mysql_select_db("db_name",$Your_Connection_String);

尝试在查询下方echo $sql;,然后将其粘贴到PHPMyAdmin或MySQL连接程序中的查询中,看看您得到的输出