Hi All,
I'm having an issue with some weird variable behavior. I could be overlooking something simple, but I figured I'd throw it out there since I can't seem to figure it out.
I have a page that takes a variable in from GET called $pageview, it basically decides whether or not you want your results, or everyones.
Here's where it gets weird. You load the page in view 1, your results, and if I echo $pageview at the top of the page, it displays "pageview: 1", ok all good.
At the bottom of the page, it says "pageview: 2", not good. I moved the echo string down through the script until I found where it's being changed. Here is where it's changing:
echo "pageview: $pageview"; //This one prints the correct value of 1
if ($pageview = 1) {
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM REQUESTS WHERE REQUESTOR = '$user'"),0); }
if ($pageview = 2) {
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM REQUESTS"),0); }
echo "pageview: $pageview"; //This one changes it to 2, and if above I change $pageview = 1, it says one. What the hell is going on here? Why is this comparison setting the variable to something else?
{
I'm sure something boneheaded is going on here, any help would be sweet. Thanks everyone.