I just cant seem to work out why this doesn't work. My PHP book doesn't
explain "if" statements very well so i have no idea if i am breaking a rule.
$system_day = date("j");
for($day = 1; $day < 32; $day++){
if($day = $system_day){
echo "match!";
}
else{
echo "no match";
}
}
the problem i am experiencing is that it seems the "if" statement is setting
the $day value to equal $system_day instead of comparing their values....
if i add
echo "Day: " . $day . " System_day: " . $system_day;
before and after the if statement then the first result is something like
Day: 1 System_day: 29
after the "if" statement has executed the result is
Day: 29 System_day: 29
so you see, instead of "if" comparing $day to $system_day it is making $day
equal to $system_day.
any ideas why and how to fix this?
help is most appreciated :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php