|
Posted by Cas on 10/23/24 11:14
Maybe it's also an idea to close the <strong> tag ;-)
to make life easier:
if ($n=$Pagenum)
{
print '<strong>'.$n.'</strong>';
}else{
print '<a href="pag_gallery.php?Pagenum='.$n.'">'.$n.'</a>';
}
On 4/25/05, Ryan A <ryan@coinpass.com> wrote:
> Hey,
> This is a common mistake...have a look at what you wrote:
>
> >if ($n=$Pagenum) {print ' <strong> ' . $n;}
>
> take a look again....see the problem?
>
> The above will always validate to true...reason being...you gotto use the
> equal to equal to instead of just equal to...like this:
>
> if ($n==$Pagenum) {print ' <strong> ' . $n;}
>
> Hope that helped.
>
> Cheers,
> Ryan
>
> On 4/25/2005 6:40:24 PM, Ed Dorsch (edorsch@uoregon.edu) wrote:
> > Thanks Ryan!
> >
> >
> >
> > I'm having a difficult time, though, with the exact syntax. And where,
> exactly, to nest the If > then. I tried this, but it didn't
> > work. Nothing displayed and I think it got caught in an endless loop:
> >
> >
> >
> > $max=20;
> >
> > $max++;
> >
> > for ($n = 1; $n < $max; $n++)
> >
> >
> >
> > if ($n=$Pagenum) {print ' <strong> ' . $n;}
> >
> >
> >
> > else
> >
> >
> >
> > {print ' <a href="pag_gallery.php?Pagenum='.$n.'"'.'>'.$n.'</a>';}
> >
> > print ' <br><br>';
> >
> >
> >
> >
> >
> >
> >
> > -----Original Message-----
> >
> > From: Ryan A [mailto:ryan@coinpass.com]
> >
> > Sent: Monday, April 25, 2005 8:47 AM
> >
> > To: Ed Dorsch
> >
> > Cc: php
> >
> > Subject: Re: [PHP] link generating script
> >
> >
> >
> >
> >
> >
> >
> > On 4/25/2005 5:23:16 PM, Ed Dorsch (edorsch@uoregon.edu) wrote:
> >
> > >
> > I'm scripting a photo gallery page that generates links (1 through $max),
> > sends the selected number in the url, then displays a set of photos based
> on
> > the number. However, I want it to display the number of the current
> gallery
> > diffe
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.10.2 - Release Date: 4/21/2005
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
http://www.getfirefox.com/
[Back to original message]
|