0

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 = '$tournKey'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);
5
  • Try and print those queries and see if they are what they are supposed to be. Commented Jul 2, 2010 at 3:58
  • Could you echo $qryPoints at the end and tell us what it looks like? Commented Jul 2, 2010 at 3:58
  • 1
    Another thing you could do is print out the error mySQL gives you, ie: $resultPoints = mysql_query($qryPoints) or die(mysql_error()); Commented Jul 2, 2010 at 4:02
  • UPDATE members, MemberBets SET members.points = members.points + MemberBets.amountBet + MemberBets.amountBet WHERE members.member_id=MemberBets.member_id and MemberBets.MATCH_KEY ='53' and MemberBets.TOURN_KEY = '' and MemberBets.player = 'player1' holy crap what happen to my $tournKEY value hmm... going to echo the working query and see if its blank too then at least now I know what direction to look in thanks Commented Jul 2, 2010 at 4:06
  • See @tan 's answer below. You have a typo. Commented Jul 2, 2010 at 4:10

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

lol i guess this is what i get for trying to code late at night dead tired... I need sleep Thanks so much man would have never spotted that today

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.