SQL query works when run as query on server, but will not work from PHP code
I'm running this via PHP and well the first query gets run perfectly then right after it I run the second query and it does nothing. Its rows never get updated for some reason, but when I type out the query manually on the sql server, it works perfectly.
Anyone have any idea why its not working in the php code?
$qry = "UPDATE Matches SET winner ='$winner' WHERE TOURN_KEY = '$t开发者_如何转开发ournKey'AND MATCH_KEY='$matchKey' ";
$result = @mysql_query($qry);
$qryPoints = "UPDATE members, MemberBets SET members.points = members.points + MemberBets.amountBet + MemberBets.amountBet WHERE members.member_id=MemberBets.member_id and MemberBets.MATCH_KEY ='$matchKey' and MemberBets.TOURN_KEY = '$tournyKey' and MemberBets.player = '$winner'";
$resultPoints = @mysql_query($qryPoints);
You appear to have a typo. You have a $tournKey
variable in the first query and a $tournyKey
variable in the second. Since you say the first query works, I'm guessing the second variable name is wrong.
精彩评论