Re: [PHP] If else question

2002-04-23 Thread Miguel Cruz

On Tue, 23 Apr 2002, Jennifer Downey wrote:
 I am wondering. When you use an if else statement and a condition exists
 isn't the if part suppose to stop?
 Then if the condition doesn't exist it is suppose to do something else?
 
 I am wondering because I have a form that goes something like this.
 
 select such and such from the table
 if that condition  1
 echo that it can't be found
 else
 echo the form
 
 But in this case even if the condition  1 it still echoes the form.
 I am not understanding this.

If and else expect to be followed by exactly 1 statement. To aggregate
multiple statements as one, surround them with {curly braces}. I'm
guessing you didn't do that, and you're seeing the execution of all but
the first of the statements following the else.

So it should be:

  if ($var1)
echo can't be found;
  else
  {
echo first line of form;
echo second line of form;
  }

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey


 If and else expect to be followed by exactly 1 statement. To aggregate
 multiple statements as one, surround them with {curly braces}. I'm
 guessing you didn't do that, and you're seeing the execution of all but
 the first of the statements following the else.

 So it should be:

   if ($var1)
 echo can't be found;
   else
   {
 echo first line of form;
 echo second line of form;
   }
This is what I have:

if($quantity  1)
{
echo Sorry I can't seem to locate this item;
}
else
{
do this
}
So yes I have done exactly as you have stated and it still shows the form.

Jennifer


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] If else question

2002-04-23 Thread Leotta, Natalie (NCI/IMS)

Does it show the message and the form or just the message?

-Natalie

-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, April 23, 2002 12:23 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] If else question



 If and else expect to be followed by exactly 1 statement. To aggregate 
 multiple statements as one, surround them with {curly braces}. I'm 
 guessing you didn't do that, and you're seeing the execution of all 
 but the first of the statements following the else.

 So it should be:

   if ($var1)
 echo can't be found;
   else
   {
 echo first line of form;
 echo second line of form;
   }
This is what I have:

if($quantity  1)
{
echo Sorry I can't seem to locate this item;
}
else
{
do this
}
So yes I have done exactly as you have stated and it still shows the form.

Jennifer


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey

It shows both.

Natalie Leotta [EMAIL PROTECTED] wrote in message
7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG...
 Does it show the message and the form or just the message?

 -Natalie

 -Original Message-
 From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, April 23, 2002 12:23 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] If else question



  If and else expect to be followed by exactly 1 statement. To aggregate
  multiple statements as one, surround them with {curly braces}. I'm
  guessing you didn't do that, and you're seeing the execution of all
  but the first of the statements following the else.
 
  So it should be:
 
if ($var1)
  echo can't be found;
else
{
  echo first line of form;
  echo second line of form;
}
 This is what I have:

 if($quantity  1)
 {
 echo Sorry I can't seem to locate this item;
 }
 else
 {
 do this
 }
 So yes I have done exactly as you have stated and it still shows the form.

 Jennifer


 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] If else question

2002-04-23 Thread Leotta, Natalie (NCI/IMS)

My officemate and I talked about this and the only thing he could come up
with was a possible problem with your parser.  Are you using a beta version
or something unusual?  I don't know if you have a way to know this - the
programmers didn't set up PHP where I work, but I know our web server is
apache and it's on a unix box.  I've never run into this problem before.
Have you had it happen in other programs?  Have you ever used this code in
another program?  If it's consistently incorrect then it may be a problem
with your parser.  That's not really my area of expertise, but it's
something you could look into if no one else has any better ideas :-)

-Natalie

-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, April 23, 2002 12:26 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] If else question


It shows both.

Natalie Leotta [EMAIL PROTECTED] wrote in message
7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG...
 Does it show the message and the form or just the message?

 -Natalie

 -Original Message-
 From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, April 23, 2002 12:23 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] If else question



  If and else expect to be followed by exactly 1 statement. To 
  aggregate multiple statements as one, surround them with {curly 
  braces}. I'm guessing you didn't do that, and you're seeing the 
  execution of all but the first of the statements following the else.
 
  So it should be:
 
if ($var1)
  echo can't be found;
else
{
  echo first line of form;
  echo second line of form;
}
 This is what I have:

 if($quantity  1)
 {
 echo Sorry I can't seem to locate this item;
 }
 else
 {
 do this
 }
 So yes I have done exactly as you have stated and it still shows the 
 form.

 Jennifer


 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey


I just looked at my hosting service thinkg it may have been because they
just upgraded to 4.1 php. so I dumped my database and loaded it to my
machine at home and find that it does the same thing.

I have 4.06 php on win me my hosting service is 4.1 php on redhat linux so
I'm thinking that is not the case.

I have used this code through out my site and this is the only part it does
this on and I am not understanding why.

Jennifer




Natalie Leotta [EMAIL PROTECTED] wrote in message
7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC4@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC4@SSIMSEXCHNG...
 My officemate and I talked about this and the only thing he could come up
 with was a possible problem with your parser.  Are you using a beta
version
 or something unusual?  I don't know if you have a way to know this - the
 programmers didn't set up PHP where I work, but I know our web server is
 apache and it's on a unix box.  I've never run into this problem before.
 Have you had it happen in other programs?  Have you ever used this code in
 another program?  If it's consistently incorrect then it may be a problem
 with your parser.  That's not really my area of expertise, but it's
 something you could look into if no one else has any better ideas :-)

 -Natalie

 -Original Message-
 From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, April 23, 2002 12:26 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] If else question


 It shows both.

 Natalie Leotta [EMAIL PROTECTED] wrote in message
 7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG...
  Does it show the message and the form or just the message?
 
  -Natalie
 
  -Original Message-
  From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, April 23, 2002 12:23 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] If else question
 
 
 
   If and else expect to be followed by exactly 1 statement. To
   aggregate multiple statements as one, surround them with {curly
   braces}. I'm guessing you didn't do that, and you're seeing the
   execution of all but the first of the statements following the else.
  
   So it should be:
  
 if ($var1)
   echo can't be found;
 else
 {
   echo first line of form;
   echo second line of form;
 }
  This is what I have:
 
  if($quantity  1)
  {
  echo Sorry I can't seem to locate this item;
  }
  else
  {
  do this
  }
  So yes I have done exactly as you have stated and it still shows the
  form.
 
  Jennifer
 
 
  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php


 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] If else question

2002-04-23 Thread -BD-

Is this a nested if? (inside another if statement?)




- Original Message -
From: Jennifer Downey [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, April 23, 2002 1:05 PM
Subject: Re: [PHP] If else question



 I just looked at my hosting service thinkg it may have been because they
 just upgraded to 4.1 php. so I dumped my database and loaded it to my
 machine at home and find that it does the same thing.

 I have 4.06 php on win me my hosting service is 4.1 php on redhat linux so
 I'm thinking that is not the case.

 I have used this code through out my site and this is the only part it
does
 this on and I am not understanding why.

 Jennifer




 Natalie Leotta [EMAIL PROTECTED] wrote in message
 7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC4@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC4@SSIMSEXCHNG...
  My officemate and I talked about this and the only thing he could come
up
  with was a possible problem with your parser.  Are you using a beta
 version
  or something unusual?  I don't know if you have a way to know this - the
  programmers didn't set up PHP where I work, but I know our web server is
  apache and it's on a unix box.  I've never run into this problem before.
  Have you had it happen in other programs?  Have you ever used this code
in
  another program?  If it's consistently incorrect then it may be a
problem
  with your parser.  That's not really my area of expertise, but it's
  something you could look into if no one else has any better ideas :-)
 
  -Natalie
 
  -Original Message-
  From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, April 23, 2002 12:26 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] If else question
 
 
  It shows both.
 
  Natalie Leotta [EMAIL PROTECTED] wrote in message
  7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG...
   Does it show the message and the form or just the message?
  
   -Natalie
  
   -Original Message-
   From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, April 23, 2002 12:23 PM
   To: [EMAIL PROTECTED]
   Subject: Re: [PHP] If else question
  
  
  
If and else expect to be followed by exactly 1 statement. To
aggregate multiple statements as one, surround them with {curly
braces}. I'm guessing you didn't do that, and you're seeing the
execution of all but the first of the statements following the else.
   
So it should be:
   
  if ($var1)
echo can't be found;
  else
  {
echo first line of form;
echo second line of form;
  }
   This is what I have:
  
   if($quantity  1)
   {
   echo Sorry I can't seem to locate this item;
   }
   else
   {
   do this
   }
   So yes I have done exactly as you have stated and it still shows the
   form.
  
   Jennifer
  
  
   ---
   Outgoing mail is certified Virus Free.
   Checked by AVG anti-virus system (http://www.grisoft.com).
   Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php


 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey

No this is the first if statement but there are nested if's after that. I'd
post the code but everyone yells at me about my coding style.
If you promise not to yell I will post it.

Jennifer
-Bd- [EMAIL PROTECTED] wrote in message
001d01c1eae9$d58f4360$[EMAIL PROTECTED]">news:001d01c1eae9$d58f4360$[EMAIL PROTECTED]...
 Is this a nested if? (inside another if statement?)




 - Original Message -
 From: Jennifer Downey [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, April 23, 2002 1:05 PM
 Subject: Re: [PHP] If else question


 
  I just looked at my hosting service thinkg it may have been because they
  just upgraded to 4.1 php. so I dumped my database and loaded it to my
  machine at home and find that it does the same thing.
 
  I have 4.06 php on win me my hosting service is 4.1 php on redhat linux
so
  I'm thinking that is not the case.
 
  I have used this code through out my site and this is the only part it
 does
  this on and I am not understanding why.
 
  Jennifer
 
 
 
 
  Natalie Leotta [EMAIL PROTECTED] wrote in message
  7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC4@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC4@SSIMSEXCHNG...
   My officemate and I talked about this and the only thing he could come
 up
   with was a possible problem with your parser.  Are you using a beta
  version
   or something unusual?  I don't know if you have a way to know this -
the
   programmers didn't set up PHP where I work, but I know our web server
is
   apache and it's on a unix box.  I've never run into this problem
before.
   Have you had it happen in other programs?  Have you ever used this
code
 in
   another program?  If it's consistently incorrect then it may be a
 problem
   with your parser.  That's not really my area of expertise, but it's
   something you could look into if no one else has any better ideas :-)
  
   -Natalie
  
   -Original Message-
   From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, April 23, 2002 12:26 PM
   To: [EMAIL PROTECTED]
   Subject: Re: [PHP] If else question
  
  
   It shows both.
  
   Natalie Leotta [EMAIL PROTECTED] wrote in message
   7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG...
Does it show the message and the form or just the message?
   
-Natalie
   
-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 23, 2002 12:23 PM
To: [EMAIL PROTECTED]
    Subject: Re: [PHP] If else question
   
   
   
 If and else expect to be followed by exactly 1 statement. To
 aggregate multiple statements as one, surround them with {curly
 braces}. I'm guessing you didn't do that, and you're seeing the
 execution of all but the first of the statements following the
else.

 So it should be:

   if ($var1)
 echo can't be found;
   else
   {
 echo first line of form;
 echo second line of form;
   }
This is what I have:
   
if($quantity  1)
{
echo Sorry I can't seem to locate this item;
}
else
{
do this
}
So yes I have done exactly as you have stated and it still shows the
form.
   
Jennifer
   
   
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
   
   
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
  
  
   ---
   Outgoing mail is certified Virus Free.
   Checked by AVG anti-virus system (http://www.grisoft.com).
   Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] If else question

2002-04-23 Thread Maxim Maletsky \(PHPBeginner.com\)


Look also at the examples in docs:

--
header(Expires: Mon, 26 Jul 1997 05:00:00 GMT);// Date in the past
header(Last-Modified:  . gmdate(D, d M Y H:i:s) .  GMT); 
// always modified
header(Cache-Control: no-store, no-cache, must-revalidate);  //
HTTP/1.1
header(Cache-Control: post-check=0, pre-check=0, false);
header(Pragma: no-cache);  // HTTP/1.0 
--

php.net/header



Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins




-Original Message-
From: Richard Emery [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, April 23, 2002 7:41 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Fw: [PHP] If else question


OK...this has dragged on...

Jennifer, show us your ACTUAL code, including database access
statements.

We can't help you if you expect us to read your mind...

- Original Message -
From: Jennifer Downey [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, April 23, 2002 12:17 PM
Subject: Re: [PHP] If else question


No this is the first if statement but there are nested if's after that.
I'd post the code but everyone yells at me about my coding style. If you
promise not to yell I will post it.

Jennifer
-Bd- [EMAIL PROTECTED] wrote in message
001d01c1eae9$d58f4360$[EMAIL PROTECTED]">news:001d01c1eae9$d58f4360$[EMAIL PROTECTED]...
 Is this a nested if? (inside another if statement?)




 - Original Message -
 From: Jennifer Downey [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, April 23, 2002 1:05 PM
 Subject: Re: [PHP] If else question


 
  I just looked at my hosting service thinkg it may have been because 
  they just upgraded to 4.1 php. so I dumped my database and loaded it

  to my machine at home and find that it does the same thing.
 
  I have 4.06 php on win me my hosting service is 4.1 php on redhat 
  linux
so
  I'm thinking that is not the case.
 
  I have used this code through out my site and this is the only part 
  it
 does
  this on and I am not understanding why.
 
  Jennifer
 
 
 
 
  Natalie Leotta [EMAIL PROTECTED] wrote in message 
  7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC4@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC4@SSIMSEXCHNG...
   My officemate and I talked about this and the only thing he could 
   come
 up
   with was a possible problem with your parser.  Are you using a 
   beta
  version
   or something unusual?  I don't know if you have a way to know this

   -
the
   programmers didn't set up PHP where I work, but I know our web 
   server
is
   apache and it's on a unix box.  I've never run into this problem
before.
   Have you had it happen in other programs?  Have you ever used this
code
 in
   another program?  If it's consistently incorrect then it may be a
 problem
   with your parser.  That's not really my area of expertise, but 
   it's something you could look into if no one else has any better 
   ideas :-)
  
   -Natalie
  
   -Original Message-
   From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, April 23, 2002 12:26 PM
   To: [EMAIL PROTECTED]
   Subject: Re: [PHP] If else question
  
  
   It shows both.
  
   Natalie Leotta [EMAIL PROTECTED] wrote in message 
   7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG...
Does it show the message and the form or just the message?
   
-Natalie
   
-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 23, 2002 12:23 PM
To: [EMAIL PROTECTED]
    Subject: Re: [PHP] If else question
   
   
   
 If and else expect to be followed by exactly 1 statement. To 
 aggregate multiple statements as one, surround them with 
 {curly braces}. I'm guessing you didn't do that, and you're 
 seeing the execution of all but the first of the statements 
 following the
else.

 So it should be:

   if ($var1)
 echo can't be found;
   else
   {
 echo first line of form;
 echo second line of form;
   }
This is what I have:
   
if($quantity  1)
{
echo Sorry I can't seem to locate this item;
}
else
{
do this
}
So yes I have done exactly as you have stated and it still shows

the form.
   
Jennifer
   
   
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
   
   
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
  
  
   ---
   Outgoing mail is certified Virus Free.
   Checked by AVG anti-virus system (http://www.grisoft.com).
   Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, v

RE: [PHP] If else question

2002-04-23 Thread Maxim Maletsky \(PHPBeginner.com\)


Post it, Jennifer, post it - we promise not to yell
(ignore the yelling people - they never sleep enough, that is why...)


Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins




-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, April 23, 2002 7:18 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] If else question


No this is the first if statement but there are nested if's after that.
I'd post the code but everyone yells at me about my coding style. If you
promise not to yell I will post it.

Jennifer
-Bd- [EMAIL PROTECTED] wrote in message
001d01c1eae9$d58f4360$[EMAIL PROTECTED]">news:001d01c1eae9$d58f4360$[EMAIL PROTECTED]...
 Is this a nested if? (inside another if statement?)




 - Original Message -
 From: Jennifer Downey [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, April 23, 2002 1:05 PM
 Subject: Re: [PHP] If else question


 
  I just looked at my hosting service thinkg it may have been because 
  they just upgraded to 4.1 php. so I dumped my database and loaded it

  to my machine at home and find that it does the same thing.
 
  I have 4.06 php on win me my hosting service is 4.1 php on redhat 
  linux
so
  I'm thinking that is not the case.
 
  I have used this code through out my site and this is the only part 
  it
 does
  this on and I am not understanding why.
 
  Jennifer
 
 
 
 
  Natalie Leotta [EMAIL PROTECTED] wrote in message 
  7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC4@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC4@SSIMSEXCHNG...
   My officemate and I talked about this and the only thing he could 
   come
 up
   with was a possible problem with your parser.  Are you using a 
   beta
  version
   or something unusual?  I don't know if you have a way to know this

   -
the
   programmers didn't set up PHP where I work, but I know our web 
   server
is
   apache and it's on a unix box.  I've never run into this problem
before.
   Have you had it happen in other programs?  Have you ever used this
code
 in
   another program?  If it's consistently incorrect then it may be a
 problem
   with your parser.  That's not really my area of expertise, but 
   it's something you could look into if no one else has any better 
   ideas :-)
  
   -Natalie
  
   -Original Message-
   From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, April 23, 2002 12:26 PM
   To: [EMAIL PROTECTED]
   Subject: Re: [PHP] If else question
  
  
   It shows both.
  
   Natalie Leotta [EMAIL PROTECTED] wrote in message 
   7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG...
Does it show the message and the form or just the message?
   
-Natalie
   
-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 23, 2002 12:23 PM
To: [EMAIL PROTECTED]
    Subject: Re: [PHP] If else question
   
   
   
 If and else expect to be followed by exactly 1 statement. To 
 aggregate multiple statements as one, surround them with 
 {curly braces}. I'm guessing you didn't do that, and you're 
 seeing the execution of all but the first of the statements 
 following the
else.

 So it should be:

   if ($var1)
 echo can't be found;
   else
   {
 echo first line of form;
 echo second line of form;
   }
This is what I have:
   
if($quantity  1)
{
echo Sorry I can't seem to locate this item;
}
else
{
do this
}
So yes I have done exactly as you have stated and it still shows

the form.
   
Jennifer
   
   
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
   
   
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
  
  
   ---
   Outgoing mail is certified Virus Free.
   Checked by AVG anti-virus system (http://www.grisoft.com).
   Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, v

RE: [PHP] If else question

2002-04-23 Thread Fifield, Mike

Have you checked the obvious, that the condition of the if statement is
actually being met? I mean are you sure that $var is returning greater then
1? 


-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, April 23, 2002 11:18 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] If else question

No this is the first if statement but there are nested if's after that. I'd
post the code but everyone yells at me about my coding style.
If you promise not to yell I will post it.

Jennifer
-Bd- [EMAIL PROTECTED] wrote in message
001d01c1eae9$d58f4360$[EMAIL PROTECTED]">news:001d01c1eae9$d58f4360$[EMAIL PROTECTED]...
 Is this a nested if? (inside another if statement?)




 - Original Message -
 From: Jennifer Downey [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, April 23, 2002 1:05 PM
 Subject: Re: [PHP] If else question


 
  I just looked at my hosting service thinkg it may have been because they
  just upgraded to 4.1 php. so I dumped my database and loaded it to my
  machine at home and find that it does the same thing.
 
  I have 4.06 php on win me my hosting service is 4.1 php on redhat linux
so
  I'm thinking that is not the case.
 
  I have used this code through out my site and this is the only part it
 does
  this on and I am not understanding why.
 
  Jennifer
 
 
 
 
  Natalie Leotta [EMAIL PROTECTED] wrote in message
  7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC4@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC4@SSIMSEXCHNG...
   My officemate and I talked about this and the only thing he could come
 up
   with was a possible problem with your parser.  Are you using a beta
  version
   or something unusual?  I don't know if you have a way to know this -
the
   programmers didn't set up PHP where I work, but I know our web server
is
   apache and it's on a unix box.  I've never run into this problem
before.
   Have you had it happen in other programs?  Have you ever used this
code
 in
   another program?  If it's consistently incorrect then it may be a
 problem
   with your parser.  That's not really my area of expertise, but it's
   something you could look into if no one else has any better ideas :-)
  
   -Natalie
  
   -Original Message-
   From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, April 23, 2002 12:26 PM
   To: [EMAIL PROTECTED]
   Subject: Re: [PHP] If else question
  
  
   It shows both.
  
   Natalie Leotta [EMAIL PROTECTED] wrote in message
   7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG...
Does it show the message and the form or just the message?
   
-Natalie
   
-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 23, 2002 12:23 PM
To: [EMAIL PROTECTED]
    Subject: Re: [PHP] If else question
   
   
   
 If and else expect to be followed by exactly 1 statement. To
 aggregate multiple statements as one, surround them with {curly
 braces}. I'm guessing you didn't do that, and you're seeing the
 execution of all but the first of the statements following the
else.

 So it should be:

   if ($var1)
 echo can't be found;
   else
   {
 echo first line of form;
 echo second line of form;
   }
This is what I have:
   
if($quantity  1)
{
echo Sorry I can't seem to locate this item;
}
else
{
do this
}
So yes I have done exactly as you have stated and it still shows the
form.
   
Jennifer
   
   
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
   
   
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
  
  
   ---
   Outgoing mail is certified Virus Free.
   Checked by AVG anti-virus system (http://www.grisoft.com).
   Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey

Ok you asked for it.
Don't say I didn't warn you.

session_start();
$query = SELECT name FROM {$config[prefix]}_users WHERE
uid={$session[uid]};
$ret = mysql_query($query);
while($row = mysql_fetch_array($ret))
{

$user = $row['name'];



$query = SELECT uid, id, iname, image, quantity, type FROM
{$config[prefix]}_my_items WHERE uid={$session[uid]} AND id = '$id'
ORDER BY id;
$ret = mysql_query($query);
while($row = mysql_fetch_array($ret))
{
  $uiid = $row['uid'];
 $iid = $row['id'];
  $image = $row['image'];
  $iname = $row['iname'];
  $quantity = $row['quantity'];
  $type = $row['type'];
// this is the problem if statement. Please don't yell at me for my style.
It is easy for me to read so I'm sorry if it's not for you.
if($quantity  1)
{
echo Sorry I can't seem to locate this item;
}
else
{

session_register(uiid);
session_register(iid);
session_register(image);
session_register(iname);
session_register(quantity);
session_register(type);


   if($iid == $id)
   {

$display_block .=CENTERimg src=$image border=0brfont size =
2$inameBR$quantityBR$typeBR/font/CENTER;

echo $display_blockBRBR;

  if($type == food)
  //if the item food is present then set an option and include in the
form later
  {
   $thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION;
  }
 else
{
//if book or weapon is present then set a blank
$thisoption=;
   }
  }
}
}
}
//check if form has been submitted
if($submit)
{

}
else
{

//if the form has not been submitted run the following


   echo FORM ACTION='$PHP_SELF' METHOD='post';
   echo SELECT NAME='sort' SIZE='1' ;
   echo $thisoption;
   echo OPTION VALUE='shop'Put in my shop/OPTION;
   echo OPTION VALUE='locker'Put into my Footlocker/OPTION;
   echo OPTION VALUE='discard'Discard this item/OPTION;
   echo OPTION VALUE='donate'Donate this item/OPTION;
   echo /SELECT;
   echo INPUT TYPE='submit' VALUE='Submit' NAME='submit';
   echo /FORM;


}

Jennifer



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] If else question

2002-04-23 Thread Maxim Maletsky \(PHPBeginner.com\)



OK, here's what I've done from your code.
Check the line I mentioned.



?

session_start();
$query = SELECT name FROM {$config[prefix]}_users WHERE
uid={$session[uid]};
$ret = mysql_query($query);
while($row = mysql_fetch_array($ret)) {

$user = $row['name'];

$query = SELECT uid, id, iname, image, quantity, type FROM
{$config[prefix]}_my_items WHERE uid={$session[uid]} AND id = '$id'
ORDER BY id; $ret = mysql_query($query);

while($row = mysql_fetch_array($ret)) {
$uiid = $row['uid'];
$iid = $row['id'];
$image = $row['image'];
$iname = $row['iname'];
$quantity = $row['quantity'];
$type = $row['type'];
// this is the problem if statement. Please don't yell
at me for my style. It is easy for me to read so I'm sorry if it's not
for you. if($quantity  1) { echo Sorry I can't seem to locate this
item; } else {

session_register(uiid);
session_register(iid);
session_register(image);
session_register(iname);
session_register(quantity);
session_register(type);


if($iid == $id) {
$display_block .=CENTERimg src=$image
border=0brfont size
=2$inameBR$quantityBR$typeBR/font/CENTER;

echo $display_blockBRBR;

if($type == food) {
//if the item food is present then set
an option and include in the form later
$thisoption=OPTION VALUE=\feed\Feed
my pet\n/OPTION;
}
else {
//if book or weapon is present then set
a blank
$thisoption=;
}
}
}
}


// !
}  // WHERE IS THIS COMING FROM
// 

//check if form has been submitted
if($submit) {
// better be if(!$submit)
}
else {

//if the form has not been submitted run the following

echo FORM ACTION='$PHP_SELF' METHOD='post';
echo SELECT NAME='sort' SIZE='1' ;
echo $thisoption;
echo OPTION VALUE='shop'Put in my shop/OPTION;
echo OPTION VALUE='locker'Put into my Footlocker/OPTION;
echo OPTION VALUE='discard'Discard this item/OPTION;
echo OPTION VALUE='donate'Donate this item/OPTION;
echo /SELECT;
echo INPUT TYPE='submit' VALUE='Submit' NAME='submit';
echo /FORM;

}


?


-





Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins




-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, April 23, 2002 7:48 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] If else question


Ok you asked for it.
Don't say I didn't warn you.

session_start();
$query = SELECT name FROM {$config[prefix]}_users WHERE
uid={$session[uid]}; $ret = mysql_query($query); while($row =
mysql_fetch_array($ret)) {

$user = $row['name'];



$query = SELECT uid, id, iname, image, quantity, type FROM
{$config[prefix]}_my_items WHERE uid={$session[uid]} AND id = '$id'
ORDER BY id; $ret = mysql_query($query); while($row =
mysql_fetch_array($ret)) {
  $uiid = $row['uid'];
 $iid = $row['id'];
  $image = $row['image'];
  $iname = $row['iname'];
  $quantity = $row['quantity'];
  $type = $row['type'];
// this is the problem if statement. Please don't yell at me for my
style. It is easy for me to read so I'm sorry if it's not for you.
if($quantity  1) { echo Sorry I can't seem to locate this item; }
else {

session_register(uiid);
session_register(iid);
session_register(image);
session_register(iname);
session_register(quantity);
session_register(type);


   if($iid == $id)
   {

$display_block .=CENTERimg src=$image border=0brfont size =
2$inameBR$quantityBR$typeBR/font/CENTER;

echo $display_blockBRBR;

  if($type == food)
  //if the item food is present then set an option and include in
the form later
  {
   $thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION;
  }
 else
{
//if book or weapon is present then set a blank
$thisoption=;
   }
  }
}
}
}
//check if form has been submitted
if($submit)
{

}
else
{

//if the form has not been submitted run the following


   echo FORM ACTION='$PHP_SELF' METHOD='post';
   echo SELECT NAME='sort' SIZE='1' ;
   echo $thisoption;
   echo OPTION VALUE='shop'Put in my shop/OPTION;
   echo OPTION VALUE='locker'Put into my Footlocker/OPTION;
   echo OPTION VALUE='discard'Discard this item/OPTION;
   echo OPTION VALUE='donate'Donate this item/OPTION;
   echo /SELECT;
   echo INPUT TYPE='submit' VALUE='Submit' NAME='submit';
   echo /FORM;


}

Jennifer



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com

RE: [PHP] If else question

2002-04-23 Thread Maxim Maletsky \(PHPBeginner.com\)

Oh well.

The line I mentioned was not the right one.
I misSAW your comment.



Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins




-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, April 23, 2002 7:48 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] If else question


Ok you asked for it.
Don't say I didn't warn you.

session_start();
$query = SELECT name FROM {$config[prefix]}_users WHERE
uid={$session[uid]}; $ret = mysql_query($query); while($row =
mysql_fetch_array($ret)) {

$user = $row['name'];



$query = SELECT uid, id, iname, image, quantity, type FROM
{$config[prefix]}_my_items WHERE uid={$session[uid]} AND id = '$id'
ORDER BY id; $ret = mysql_query($query); while($row =
mysql_fetch_array($ret)) {
  $uiid = $row['uid'];
 $iid = $row['id'];
  $image = $row['image'];
  $iname = $row['iname'];
  $quantity = $row['quantity'];
  $type = $row['type'];
// this is the problem if statement. Please don't yell at me for my
style. It is easy for me to read so I'm sorry if it's not for you.
if($quantity  1) { echo Sorry I can't seem to locate this item; }
else {

session_register(uiid);
session_register(iid);
session_register(image);
session_register(iname);
session_register(quantity);
session_register(type);


   if($iid == $id)
   {

$display_block .=CENTERimg src=$image border=0brfont size =
2$inameBR$quantityBR$typeBR/font/CENTER;

echo $display_blockBRBR;

  if($type == food)
  //if the item food is present then set an option and include in
the form later
  {
   $thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION;
  }
 else
{
//if book or weapon is present then set a blank
$thisoption=;
   }
  }
}
}
}
//check if form has been submitted
if($submit)
{

}
else
{

//if the form has not been submitted run the following


   echo FORM ACTION='$PHP_SELF' METHOD='post';
   echo SELECT NAME='sort' SIZE='1' ;
   echo $thisoption;
   echo OPTION VALUE='shop'Put in my shop/OPTION;
   echo OPTION VALUE='locker'Put into my Footlocker/OPTION;
   echo OPTION VALUE='discard'Discard this item/OPTION;
   echo OPTION VALUE='donate'Donate this item/OPTION;
   echo /SELECT;
   echo INPUT TYPE='submit' VALUE='Submit' NAME='submit';
   echo /FORM;


}

Jennifer



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] If else question

2002-04-23 Thread Maxim Maletsky \(PHPBeginner.com\)


Try this, Jennifer:

Without messing the rest of your code, change the line:

$quantity = $row['quantity'];

With this one:

$quantity = 0;

In other words: hardcode it for testing.

If else always prints, then you are missing something in your query.
Otherwise you've got something wrong in your code.





Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins




-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, April 23, 2002 7:48 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] If else question


Ok you asked for it.
Don't say I didn't warn you.

session_start();
$query = SELECT name FROM {$config[prefix]}_users WHERE
uid={$session[uid]}; $ret = mysql_query($query); while($row =
mysql_fetch_array($ret)) {

$user = $row['name'];



$query = SELECT uid, id, iname, image, quantity, type FROM
{$config[prefix]}_my_items WHERE uid={$session[uid]} AND id = '$id'
ORDER BY id; $ret = mysql_query($query); while($row =
mysql_fetch_array($ret)) {
  $uiid = $row['uid'];
 $iid = $row['id'];
  $image = $row['image'];
  $iname = $row['iname'];
  $quantity = $row['quantity'];
  $type = $row['type'];
// this is the problem if statement. Please don't yell at me for my
style. It is easy for me to read so I'm sorry if it's not for you.
if($quantity  1) { echo Sorry I can't seem to locate this item; }
else {

session_register(uiid);
session_register(iid);
session_register(image);
session_register(iname);
session_register(quantity);
session_register(type);


   if($iid == $id)
   {

$display_block .=CENTERimg src=$image border=0brfont size =
2$inameBR$quantityBR$typeBR/font/CENTER;

echo $display_blockBRBR;

  if($type == food)
  //if the item food is present then set an option and include in
the form later
  {
   $thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION;
  }
 else
{
//if book or weapon is present then set a blank
$thisoption=;
   }
  }
}
}
}
//check if form has been submitted
if($submit)
{

}
else
{

//if the form has not been submitted run the following


   echo FORM ACTION='$PHP_SELF' METHOD='post';
   echo SELECT NAME='sort' SIZE='1' ;
   echo $thisoption;
   echo OPTION VALUE='shop'Put in my shop/OPTION;
   echo OPTION VALUE='locker'Put into my Footlocker/OPTION;
   echo OPTION VALUE='discard'Discard this item/OPTION;
   echo OPTION VALUE='donate'Donate this item/OPTION;
   echo /SELECT;
   echo INPUT TYPE='submit' VALUE='Submit' NAME='submit';
   echo /FORM;


}

Jennifer



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] If else question

2002-04-23 Thread Richard Emery

Now, we're getting somewhere!!!

First, have you printed out $query to ensure it contains what you expected?
Show us.

Second, are you certain the mysql_query() is successful?  I ask, because you
don't have the or die() that SHOULD be on all queries.

Third, have you printed out all the values fetched via mysql_fetch_array()
to ensure they contain valid data?

- Original Message -
From: Jennifer Downey [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, April 23, 2002 12:48 PM
Subject: Re: [PHP] If else question


Ok you asked for it.
Don't say I didn't warn you.

session_start();
$query = SELECT name FROM {$config[prefix]}_users WHERE
uid={$session[uid]};
$ret = mysql_query($query);
while($row = mysql_fetch_array($ret))
{

$user = $row['name'];



$query = SELECT uid, id, iname, image, quantity, type FROM
{$config[prefix]}_my_items WHERE uid={$session[uid]} AND id = '$id'
ORDER BY id;
$ret = mysql_query($query);
while($row = mysql_fetch_array($ret))
{
  $uiid = $row['uid'];
 $iid = $row['id'];
  $image = $row['image'];
  $iname = $row['iname'];
  $quantity = $row['quantity'];
  $type = $row['type'];
// this is the problem if statement. Please don't yell at me for my style.
It is easy for me to read so I'm sorry if it's not for you.
if($quantity  1)
{
echo Sorry I can't seem to locate this item;
}
else
{

session_register(uiid);
session_register(iid);
session_register(image);
session_register(iname);
session_register(quantity);
session_register(type);


   if($iid == $id)
   {

$display_block .=CENTERimg src=$image border=0brfont size =
2$inameBR$quantityBR$typeBR/font/CENTER;

echo $display_blockBRBR;

  if($type == food)
  file://if the item food is present then set an option and include in
the
form later
  {
   $thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION;
  }
 else
{
file://if book or weapon is present then set a blank
$thisoption=;
   }
  }
}
}
}
file://check if form has been submitted
if($submit)
{

}
else
{

file://if the form has not been submitted run the following


   echo FORM ACTION='$PHP_SELF' METHOD='post';
   echo SELECT NAME='sort' SIZE='1' ;
   echo $thisoption;
   echo OPTION VALUE='shop'Put in my shop/OPTION;
   echo OPTION VALUE='locker'Put into my Footlocker/OPTION;
   echo OPTION VALUE='discard'Discard this item/OPTION;
   echo OPTION VALUE='donate'Donate this item/OPTION;
   echo /SELECT;
   echo INPUT TYPE='submit' VALUE='Submit' NAME='submit';
   echo /FORM;


}

Jennifer



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] If else question

2002-04-23 Thread -BD-

am i off on the wrong track here? i thought the original problem was that
both clauses in the if statement were exectuting (the 'if' and the 'else')?






 Now, we're getting somewhere!!!

 First, have you printed out $query to ensure it contains what you
expected?
 Show us.

 Second, are you certain the mysql_query() is successful?  I ask, because
you
 don't have the or die() that SHOULD be on all queries.

 Third, have you printed out all the values fetched via mysql_fetch_array()
 to ensure they contain valid data?

 - Original Message -
 From: Jennifer Downey [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, April 23, 2002 12:48 PM
 Subject: Re: [PHP] If else question


 Ok you asked for it.
 Don't say I didn't warn you.

 session_start();
 $query = SELECT name FROM {$config[prefix]}_users WHERE
 uid={$session[uid]};
 $ret = mysql_query($query);
 while($row = mysql_fetch_array($ret))
 {

 $user = $row['name'];



 $query = SELECT uid, id, iname, image, quantity, type FROM
 {$config[prefix]}_my_items WHERE uid={$session[uid]} AND id = '$id'
 ORDER BY id;
 $ret = mysql_query($query);
 while($row = mysql_fetch_array($ret))
 {
   $uiid = $row['uid'];
  $iid = $row['id'];
   $image = $row['image'];
   $iname = $row['iname'];
   $quantity = $row['quantity'];
   $type = $row['type'];
 // this is the problem if statement. Please don't yell at me for my style.
 It is easy for me to read so I'm sorry if it's not for you.
 if($quantity  1)
 {
 echo Sorry I can't seem to locate this item;
 }
 else
 {

 session_register(uiid);
 session_register(iid);
 session_register(image);
 session_register(iname);
 session_register(quantity);
 session_register(type);


if($iid == $id)
{

 $display_block .=CENTERimg src=$image border=0brfont size =
 2$inameBR$quantityBR$typeBR/font/CENTER;

 echo $display_blockBRBR;

   if($type == food)
   file://if the item food is present then set an option and include in
 the
 form later
   {
$thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION;
   }
  else
 {
 file://if book or weapon is present then set a blank
 $thisoption=;
}
   }
 }
 }
 }
 file://check if form has been submitted
 if($submit)
 {

 }
 else
 {

 file://if the form has not been submitted run the following


echo FORM ACTION='$PHP_SELF' METHOD='post';
echo SELECT NAME='sort' SIZE='1' ;
echo $thisoption;
echo OPTION VALUE='shop'Put in my shop/OPTION;
echo OPTION VALUE='locker'Put into my Footlocker/OPTION;
echo OPTION VALUE='discard'Discard this item/OPTION;
echo OPTION VALUE='donate'Donate this item/OPTION;
echo /SELECT;
echo INPUT TYPE='submit' VALUE='Submit' NAME='submit';
echo /FORM;


 }

 Jennifer



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] If else question

2002-04-23 Thread Maxim Maletsky \(PHPBeginner.com\)

Jennifer, satus!
People are nervous here!


Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins




-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, April 23, 2002 7:48 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] If else question


Ok you asked for it.
Don't say I didn't warn you.

session_start();
$query = SELECT name FROM {$config[prefix]}_users WHERE
uid={$session[uid]}; $ret = mysql_query($query); while($row =
mysql_fetch_array($ret)) {

$user = $row['name'];



$query = SELECT uid, id, iname, image, quantity, type FROM
{$config[prefix]}_my_items WHERE uid={$session[uid]} AND id = '$id'
ORDER BY id; $ret = mysql_query($query); while($row =
mysql_fetch_array($ret)) {
  $uiid = $row['uid'];
 $iid = $row['id'];
  $image = $row['image'];
  $iname = $row['iname'];
  $quantity = $row['quantity'];
  $type = $row['type'];
// this is the problem if statement. Please don't yell at me for my
style. It is easy for me to read so I'm sorry if it's not for you.
if($quantity  1) { echo Sorry I can't seem to locate this item; }
else {

session_register(uiid);
session_register(iid);
session_register(image);
session_register(iname);
session_register(quantity);
session_register(type);


   if($iid == $id)
   {

$display_block .=CENTERimg src=$image border=0brfont size =
2$inameBR$quantityBR$typeBR/font/CENTER;

echo $display_blockBRBR;

  if($type == food)
  //if the item food is present then set an option and include in
the form later
  {
   $thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION;
  }
 else
{
//if book or weapon is present then set a blank
$thisoption=;
   }
  }
}
}
}
//check if form has been submitted
if($submit)
{

}
else
{

//if the form has not been submitted run the following


   echo FORM ACTION='$PHP_SELF' METHOD='post';
   echo SELECT NAME='sort' SIZE='1' ;
   echo $thisoption;
   echo OPTION VALUE='shop'Put in my shop/OPTION;
   echo OPTION VALUE='locker'Put into my Footlocker/OPTION;
   echo OPTION VALUE='discard'Discard this item/OPTION;
   echo OPTION VALUE='donate'Donate this item/OPTION;
   echo /SELECT;
   echo INPUT TYPE='submit' VALUE='Submit' NAME='submit';
   echo /FORM;


}

Jennifer



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey

You  are on the right track.
-Bd- [EMAIL PROTECTED] wrote in message
00a301c1eaf3$b181a260$[EMAIL PROTECTED]">news:00a301c1eaf3$b181a260$[EMAIL PROTECTED]...
 am i off on the wrong track here? i thought the original problem was that
 both clauses in the if statement were exectuting (the 'if' and the
'else')?






  Now, we're getting somewhere!!!
 
  First, have you printed out $query to ensure it contains what you
 expected?
  Show us.
 
  Second, are you certain the mysql_query() is successful?  I ask, because
 you
  don't have the or die() that SHOULD be on all queries.
 
  Third, have you printed out all the values fetched via
mysql_fetch_array()
  to ensure they contain valid data?
 
  - Original Message -
  From: Jennifer Downey [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, April 23, 2002 12:48 PM
  Subject: Re: [PHP] If else question
 
 
  Ok you asked for it.
  Don't say I didn't warn you.
 
  session_start();
  $query = SELECT name FROM {$config[prefix]}_users WHERE
  uid={$session[uid]};
  $ret = mysql_query($query);
  while($row = mysql_fetch_array($ret))
  {
 
  $user = $row['name'];
 
 
 
  $query = SELECT uid, id, iname, image, quantity, type FROM
  {$config[prefix]}_my_items WHERE uid={$session[uid]} AND id = '$id'
  ORDER BY id;
  $ret = mysql_query($query);
  while($row = mysql_fetch_array($ret))
  {
$uiid = $row['uid'];
   $iid = $row['id'];
$image = $row['image'];
$iname = $row['iname'];
$quantity = $row['quantity'];
$type = $row['type'];
  // this is the problem if statement. Please don't yell at me for my
style.
  It is easy for me to read so I'm sorry if it's not for you.
  if($quantity  1)
  {
  echo Sorry I can't seem to locate this item;
  }
  else
  {
 
  session_register(uiid);
  session_register(iid);
  session_register(image);
  session_register(iname);
  session_register(quantity);
  session_register(type);
 
 
 if($iid == $id)
 {
 
  $display_block .=CENTERimg src=$image border=0brfont size =
  2$inameBR$quantityBR$typeBR/font/CENTER;
 
  echo $display_blockBRBR;
 
if($type == food)
file://if the item food is present then set an option and include
in
  the
  form later
{
 $thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION;
}
   else
  {
  file://if book or weapon is present then set a blank
  $thisoption=;
 }
}
  }
  }
  }
  file://check if form has been submitted
  if($submit)
  {
 
  }
  else
  {
 
  file://if the form has not been submitted run the following
 
 
 echo FORM ACTION='$PHP_SELF' METHOD='post';
 echo SELECT NAME='sort' SIZE='1' ;
 echo $thisoption;
 echo OPTION VALUE='shop'Put in my shop/OPTION;
 echo OPTION VALUE='locker'Put into my Footlocker/OPTION;
 echo OPTION VALUE='discard'Discard this item/OPTION;
 echo OPTION VALUE='donate'Donate this item/OPTION;
 echo /SELECT;
 echo INPUT TYPE='submit' VALUE='Submit' NAME='submit';
 echo /FORM;
 
 
  }
 
  Jennifer




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey

Ok I have hard coded $quantity so it does = 0 and else still prints.
Maxim Maletsky ) [EMAIL PROTECTED] wrote in message
004701c1eaf1$c915c6b0$92e3021a@machine52">news:004701c1eaf1$c915c6b0$92e3021a@machine52...

 Try this, Jennifer:

 Without messing the rest of your code, change the line:

 $quantity = $row['quantity'];

 With this one:

 $quantity = 0;

 In other words: hardcode it for testing.

 If else always prints, then you are missing something in your query.
 Otherwise you've got something wrong in your code.





 Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 www.PHPBeginner.com   // where PHP Begins




 -Original Message-
 From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, April 23, 2002 7:48 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] If else question


 Ok you asked for it.
 Don't say I didn't warn you.

 session_start();
 $query = SELECT name FROM {$config[prefix]}_users WHERE
 uid={$session[uid]}; $ret = mysql_query($query); while($row =
 mysql_fetch_array($ret)) {

 $user = $row['name'];



 $query = SELECT uid, id, iname, image, quantity, type FROM
 {$config[prefix]}_my_items WHERE uid={$session[uid]} AND id = '$id'
 ORDER BY id; $ret = mysql_query($query); while($row =
 mysql_fetch_array($ret)) {
   $uiid = $row['uid'];
  $iid = $row['id'];
   $image = $row['image'];
   $iname = $row['iname'];
   $quantity = $row['quantity'];
   $type = $row['type'];
 // this is the problem if statement. Please don't yell at me for my
 style. It is easy for me to read so I'm sorry if it's not for you.
 if($quantity  1) { echo Sorry I can't seem to locate this item; }
 else {

 session_register(uiid);
 session_register(iid);
 session_register(image);
 session_register(iname);
 session_register(quantity);
 session_register(type);


if($iid == $id)
{

 $display_block .=CENTERimg src=$image border=0brfont size =
 2$inameBR$quantityBR$typeBR/font/CENTER;

 echo $display_blockBRBR;

   if($type == food)
   //if the item food is present then set an option and include in
 the form later
   {
$thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION;
   }
  else
 {
 //if book or weapon is present then set a blank
 $thisoption=;
}
   }
 }
 }
 }
 //check if form has been submitted
 if($submit)
 {

 }
 else
 {

 //if the form has not been submitted run the following


echo FORM ACTION='$PHP_SELF' METHOD='post';
echo SELECT NAME='sort' SIZE='1' ;
echo $thisoption;
echo OPTION VALUE='shop'Put in my shop/OPTION;
echo OPTION VALUE='locker'Put into my Footlocker/OPTION;
echo OPTION VALUE='discard'Discard this item/OPTION;
echo OPTION VALUE='donate'Donate this item/OPTION;
echo /SELECT;
echo INPUT TYPE='submit' VALUE='Submit' NAME='submit';
echo /FORM;


 }

 Jennifer



 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] If else question

2002-04-23 Thread heinisch

Aeh, sorry - but is the 1 you test for actual a number or is it a string?
I had made this mistakes earlier, so also try
if ( $quantity == 1)

Maybe I´m absolutely wrong, (PHP 3 knowledge) but

Oliver

At 23.04.2002  10:48, you wrote:
Ok you asked for it.
Don't say I didn't warn you.

session_start();
$query = SELECT name FROM {$config[prefix]}_users WHERE
uid={$session[uid]};
$ret = mysql_query($query);
while($row = mysql_fetch_array($ret))
{
$user = $row['name'];
$query = SELECT uid, id, iname, image, quantity, type FROM
{$config[prefix]}_my_items WHERE uid={$session[uid]} AND id = '$id'
ORDER BY id;
$ret = mysql_query($query);
while($row = mysql_fetch_array($ret))
{
   $uiid = $row['uid'];
  $iid = $row['id'];
   $image = $row['image'];
   $iname = $row['iname'];
   $quantity = $row['quantity'];
   $type = $row['type'];
// this is the problem if statement. Please don't yell at me for my style.
It is easy for me to read so I'm sorry if it's not for you.
if($quantity  1)
{
echo Sorry I can't seem to locate this item;
}
else
{
session_register(uiid);
session_register(iid);
session_register(image);
session_register(iname);
session_register(quantity);
session_register(type);
   if($iid == $id)
{

 $display_block .=CENTERimg src=$image border=0brfont size =
2$inameBR$quantityBR$typeBR/font/CENTER;

 echo $display_blockBRBR;

   if($type == food)
   //if the item food is present then set an option and include in the
form later
   {
$thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION;
   }
  else
 {
 //if book or weapon is present then set a blank
 $thisoption=;
}
   }
}
}
}
//check if form has been submitted
if($submit)
{

}
else
{

//if the form has not been submitted run the following


echo FORM ACTION='$PHP_SELF' METHOD='post';
echo SELECT NAME='sort' SIZE='1' ;
echo $thisoption;
echo OPTION VALUE='shop'Put in my shop/OPTION;
echo OPTION VALUE='locker'Put into my Footlocker/OPTION;
echo OPTION VALUE='discard'Discard this item/OPTION;
echo OPTION VALUE='donate'Donate this item/OPTION;
echo /SELECT;
echo INPUT TYPE='submit' VALUE='Submit' NAME='submit';
echo /FORM;
}
Jennifer


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] If else question

2002-04-23 Thread Miguel Cruz

The form is outputting as a consequence of the condition in:

  if($submit)

testing false.

Maybe this is happening because you don't have register_globals turned on 
so that $submit never gets populated from the INPUT TYPE='submit' 
VALUE='Submit' NAME='submit' form element.

miguel

On Tue, 23 Apr 2002, Jennifer Downey wrote:

 Ok I have hard coded $quantity so it does = 0 and else still prints.
 Maxim Maletsky ) [EMAIL PROTECTED] wrote in message
 004701c1eaf1$c915c6b0$92e3021a@machine52">news:004701c1eaf1$c915c6b0$92e3021a@machine52...
 
  Try this, Jennifer:
 
  Without messing the rest of your code, change the line:
 
  $quantity = $row['quantity'];
 
  With this one:
 
  $quantity = 0;
 
  In other words: hardcode it for testing.
 
  If else always prints, then you are missing something in your query.
  Otherwise you've got something wrong in your code.
 
 
 
 
 
  Sincerely,
 
  Maxim Maletsky
  Founder, Chief Developer
 
  www.PHPBeginner.com   // where PHP Begins
 
 
 
 
  -Original Message-
  From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, April 23, 2002 7:48 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] If else question
 
 
  Ok you asked for it.
  Don't say I didn't warn you.
 
  session_start();
  $query = SELECT name FROM {$config[prefix]}_users WHERE
  uid={$session[uid]}; $ret = mysql_query($query); while($row =
  mysql_fetch_array($ret)) {
 
  $user = $row['name'];
 
 
 
  $query = SELECT uid, id, iname, image, quantity, type FROM
  {$config[prefix]}_my_items WHERE uid={$session[uid]} AND id = '$id'
  ORDER BY id; $ret = mysql_query($query); while($row =
  mysql_fetch_array($ret)) {
$uiid = $row['uid'];
   $iid = $row['id'];
$image = $row['image'];
$iname = $row['iname'];
$quantity = $row['quantity'];
$type = $row['type'];
  // this is the problem if statement. Please don't yell at me for my
  style. It is easy for me to read so I'm sorry if it's not for you.
  if($quantity  1) { echo Sorry I can't seem to locate this item; }
  else {
 
  session_register(uiid);
  session_register(iid);
  session_register(image);
  session_register(iname);
  session_register(quantity);
  session_register(type);
 
 
 if($iid == $id)
 {
 
  $display_block .=CENTERimg src=$image border=0brfont size =
  2$inameBR$quantityBR$typeBR/font/CENTER;
 
  echo $display_blockBRBR;
 
if($type == food)
//if the item food is present then set an option and include in
  the form later
{
 $thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION;
}
   else
  {
  //if book or weapon is present then set a blank
  $thisoption=;
 }
}
  }
  }
  }
  //check if form has been submitted
  if($submit)
  {
 
  }
  else
  {
 
  //if the form has not been submitted run the following
 
 
 echo FORM ACTION='$PHP_SELF' METHOD='post';
 echo SELECT NAME='sort' SIZE='1' ;
 echo $thisoption;
 echo OPTION VALUE='shop'Put in my shop/OPTION;
 echo OPTION VALUE='locker'Put into my Footlocker/OPTION;
 echo OPTION VALUE='discard'Discard this item/OPTION;
 echo OPTION VALUE='donate'Donate this item/OPTION;
 echo /SELECT;
 echo INPUT TYPE='submit' VALUE='Submit' NAME='submit';
 echo /FORM;
 
 
  }
 
  Jennifer
 
 
 
  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
 
 
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] If else question

2002-04-23 Thread Jason Soza

I don't know how much this is worth, but it helped me deal with an 
if/else statement that was killing me.

I just coded a very simple if/else statement like so:

?PHP
$a = 1;
$b = 2;

if($a  $b) {
echo A is smaller than B;
}
else {
echo B is smaller than A;
}
?

And I made SURE that worked. Once it did, I started adding things, 
making sure it worked after each change until I got it where I wanted 
it. Once it did what I wanted, I copied it into my working script. 
Sometimes it works to just start over with something simpler, then work 
your way back up.

HTH,

Jason Soza

- Original Message -
From: Jennifer Downey [EMAIL PROTECTED]
Date: Tuesday, April 23, 2002 10:26 am
Subject: Re: [PHP] If else question

 Ok I have hard coded $quantity so it does = 0 and else still prints.
 Maxim Maletsky ) [EMAIL PROTECTED] wrote in message
 004701c1eaf1$c915c6b0$92e3021a@machine52">news:004701c1eaf1$c915c6b0$92e3021a@machine52...
 
  Try this, Jennifer:
 
  Without messing the rest of your code, change the line:
 
  $quantity = $row['quantity'];
 
  With this one:
 
  $quantity = 0;
 
  In other words: hardcode it for testing.
 
  If else always prints, then you are missing something in your 
 query. Otherwise you've got something wrong in your code.
 
 
 
 
 
  Sincerely,
 
  Maxim Maletsky
  Founder, Chief Developer
 
  www.PHPBeginner.com   // where PHP Begins


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey

I have it. I actually got it!

I had the if statement in the wrong place.

Here is what I did:

if($quantity 1)
{
 echo Sorry I can't seem to locate this item;
}
else
{
//check if form has been submitted
if($submit)
{
}
else
{

//if the form has not been submitted run the following


   echo FORM ACTION='sortitems.php'METHOD='post';
   echo SELECT NAME='sort' SIZE='1' ;
   echo $thisoption;
   echo OPTION VALUE='shop'Put in my shop/OPTION;
   echo OPTION VALUE='locker'Put into my Footlocker/OPTION;
   echo OPTION VALUE='discard'Discard this item/OPTION;
   echo OPTION VALUE='donate'Donate this item/OPTION;
   echo /SELECT;
   echo INPUT TYPE='submit' VALUE='Submit' NAME='submit';
   echo /FORM;
}
}
}

and it worked perfectly!

Thank you ALL for your time and help!
Jennifer

P.S. You people are wonderfull!




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] If...Else question

2002-03-14 Thread Vlad Kulchitski

Of course it's legal, absolutely.

You have to make sure though that you
don't use double quotes in php portion,
and if you do, you have to escape them
for instance:

echo font color=\red\;

if you paste the code that's causing the
problem, we can take a look.

Vlad

-Original Message-
From: Brad Harriger [mailto:[EMAIL PROTECTED]] 
Sent: 14 ÂÅÒÅÚÎÑ 2002 Ò. 10:52
To: [EMAIL PROTECTED]
Subject: [PHP] If...Else question

Is it legal for an if...else statement to span PHP code blocks? Here's 
an example:

?

$a = 0;
if ($a  5) {
   $b = 50;
   $c=500;

// Take a break from php and put in some HTML

?

HTML
   HEAD/HEAD
   BODYMORE HTML CODE HERE/BODY
/HTML

?

// Now back to the PHP code

   $d = 250;
}
else {
   $e = Does not apply.
}

?

I have some code similar to this example.  When I run the code in my 
browser, I get a parse error on the last line (?).


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] If...Else question

2002-03-14 Thread Nick Winfield

On Thu, 14 Mar 2002, Brad Harriger wrote:

!-- snip --

 ?

 // Now back to the PHP code

$d = 250;
 }
 else {
$e = Does not apply.
 }

 ?

 I have some code similar to this example.  When I run the code in my
 browser, I get a parse error on the last line (?).

Replace:

$e = Does not apply.

with:

$e = Does not apply.;

Cheers,

Nick Winfield.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php