PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
JAB Creations
DevNet Resident
Posts: 2341 Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:
Post
by JAB Creations » Sat Nov 15, 2008 3:35 am
The following for loop works just fine until I uncomment the if conditions, can someone kindly explain why please?
Code: Select all
for ($i = 1; $i <= $pages; $i++)
{
echo '<option ';
//if ($i = $_GET['p']) {echo 'selected="selected" ';}
echo 'value="'.$i.'">';
//if ($i = $_GET['p']) {echo 'You are currently viewing ';}
echo 'Page '.$i.'</option>'."\n";
}
alex.barylski
DevNet Evangelist
Posts: 6267 Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg
Post
by alex.barylski » Sat Nov 15, 2008 3:46 am
See point #5 in my blog entry.
Your using a assignment instead of comparison in both IF's that might have something to do with it.
JAB Creations
DevNet Resident
Posts: 2341 Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:
Post
by JAB Creations » Sat Nov 15, 2008 3:49 am
DOH!
Thanks for pointing out the obvious...
"No question is so difficult to answer as that to which the answer is obvious." - George Bernard Shaw
alex.barylski
DevNet Evangelist
Posts: 6267 Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg
Post
by alex.barylski » Sat Nov 15, 2008 3:54 am
Haha...it happens...your eyes get tired and you miss stupid little things like that...
p.s-Your situation doesn't apply to my blog either, so nevermind about that.
JAB Creations
DevNet Resident
Posts: 2341 Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:
Post
by JAB Creations » Sat Nov 15, 2008 3:55 am
I'm not tired right now...I have an odd sleeping pattern at the moment.
I'm reading your blog right now, thanks for mentioning it.