IF statement in WHILE statement
am 14.02.2007 05:29:58 von Matthew Ferry
------=_NextPart_000_018C_01C74FC6.E00EBE50
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello Everyone,
Got another simple problem here....
I am trying to do a if statement inside a while (mysql_fetch_array)
Here is my code:
if ($link =3D mysql_tech_array($links)) {
do {
if ($_GET['page'] =3D "$link[file]") {
$status =3D 'reg_button.php';
} else {
$status =3D 'push_button.php';
}
echo "
src=3D'$status?text=3D$link[name]\n'>\n";
} while ($link =3D mysql_fetch_array($links));
} else {=20
echo "Link Error";
}
This code loads links across a page. The active page needs to get the =
PUSH_BUTTON.php file
The loop needs to set the status then do the echo line...then start =
again for each rows in the array.
thanks
Matt
------=_NextPart_000_018C_01C74FC6.E00EBE50--
Re: IF statement in WHILE statement
am 14.02.2007 05:53:18 von dmagick
Matthew Ferry wrote:
> Hello Everyone,
>
> Got another simple problem here....
>
> I am trying to do a if statement inside a while (mysql_fetch_array)
>
>
>
> Here is my code:
>
> if ($link = mysql_tech_array($links)) {
>
>
>
> do {
>
> if ($_GET['page'] = "$link[file]") {
You're assigning $_GET['page'] to whatever is in $link['file'].
It should be '==' not '=' to do a comparison.
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: IF statement in WHILE statement
am 14.02.2007 06:20:43 von Matthew Ferry
Thanks Chris...
added the extra =
and its working fine...
Have a nice day everyone!!!!
Matt
----- Original Message -----
From: "Chris"
To: "Matthew Ferry"
Cc:
Sent: Tuesday, February 13, 2007 11:53 PM
Subject: Re: [PHP-DB] IF statement in WHILE statement
> Matthew Ferry wrote:
> > Hello Everyone,
> >
> > Got another simple problem here....
> >
> > I am trying to do a if statement inside a while (mysql_fetch_array)
> >
> >
> >
> > Here is my code:
> >
> > if ($link = mysql_tech_array($links)) {
> >
> >
> >
> > do {
> >
> > if ($_GET['page'] = "$link[file]") {
>
> You're assigning $_GET['page'] to whatever is in $link['file'].
>
> It should be '==' not '=' to do a comparison.
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php