Forum Moderators: coopster
if(07 >= $week1 && $week1 > 00)
{
$week2 = 1;
}
if(07 >= $week1 && $week1 > 00) $week2 .= 1;
I have tried using quotes on all the numbers, setting the numbers as $vars before setting them in the IF statement. I just don't know why it doesn't work. If I were to do (07 >= $week1 > 00) I would get a parse error on the '>' but I don't think that would return the same result anyway.
The problem is that $week2 comes out empty.
please help me figure this out.
thanks a lot,
Mike
$week1 does not fall within that range of numbers, or it is not in a number format like that, but something entirely different. Before you try the comparison, echo out the value of $week1 to see if it is exactly what you want it to be. Then from there you can adjust other code accordingly.
test.php?week=08
<?php
$week1 = "null";
$week2 = "null";
if(isset($_GET['week']))
{
$week1 = $_GET['week'];
if(07 >= $week1 && $week1 > 00) $week2 = 1;
else $week2 = 0;
}
echo "Week1: $week1<br />Week2: $week2";
?>
and it works as expected.
Therefore there must be some other problem
Try echoing the $week1, as eelix suggested. And also turn error_reporting(E_ALL);
Regards
Michal
$week1 = date('d');
which prints out as '02' right now. How would I go about turning the error_reporting on? I'm just trying to set a value to 1-4 depending on what day it is 01-07, 07-14, etc. I dont' know if there is another way to do this because I didn't think there was too much wrong with my code. Unless it is the date function doing something?
thanks,
Mike
just that you know:
<?php
error_reporting [php.net](E_ALL);
?>
this is how you turn all errors to show up.
Glad you found the mistake!
Michal