PHP Mysql - MySQL_Query命令未运行

时间:2013-10-31 20:08:41

标签: php mysql

不确定原因,但这行甚至没有出错,它只是不运行,并且在运行后也会停止任何代码。我已经在声明的任一侧检查了死(“检查”),并且只在之前运行。

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

知道它为什么不运行?

2 个答案:

答案 0 :(得分:0)

将其更改为

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

答案 1 :(得分:0)

试试这个:

$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 Connection程序中的查询中,看看你得到了什么输出