Aaron,

Try this:
if($row["home_score"] == 255)

== is test for equality
= is used for assignment of value

Hope it solves the problem - Miles

PS We've all been bitten by it.


At 09:40 PM 8/9/01 -0400, Aaron Vegh wrote:
>Hi there!
>
>Say I have a MySQL table like this:
>
>Away_Team     Score     Home_Team         Score       spread
>Atlanta            255        San Francisco        255         2
>
>The team names are loaded into the table before my application starts, and
>all scores are given a default value of 255. One one page, I am able to
>update the spread (in this case, giving it a value of 2).
>
>Here's where the problem happens. On the page where I want to enter the
>scores (the game results), I want each row of that week's schedule to be  a
>database entry form, _IF_ no score has been entered before. That is done
>using a code fragment like this:
>
>If ($row["home_score"] = 255)
>     run code to output a db entry form
>
>But what happens is, the code ignores the value of 255 and instead prints
>out my "else..." code (which simply outputs the done row with no db entry).
>And the funny thing is, IF I DON'T UPDATE THE SPREAD ON THE FIRST PAGE, THEN
>THE GIVEN ROW WILL WORK PERFECTLY ON THE RESULTS PAGE. To summarize:
>
>1. If I don't add a spread to the record on the first page, then the results
>page works perfectly.
>2. If I do add a spread to the record on the first page, then the code
>thinks that the $home_score != 255, when in fact it still does.
>
>The only theory I have is that somehow, PHP is getting the wrong value for
>the score after the db record has been updated. But I don't understand why!
>
>Any insight anyone can provide would be much appreciated. Please, if you
>can, reply directly to my email address as well as this list.
>
>Thanks,
>Aaron.
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to