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 ""
ril 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@ma
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.
another try.
I looks to me as if one row executes the IF and another one the ELSE
Statement ( try to let the script die(); after one the first while.
red
-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 23. April 2002 8:31 PM
An: [EMAIL PRO
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.
>
>ses
'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]]
>
> >
> > ----- 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.
] 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[
n 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 wa
d 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
TECTED]
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($
: [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_
ot;;
echo "";
echo "";
}
?>
-
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
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, typ
]
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
00
]]
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.
Jen
r
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,
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]> wr
TECTED]">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
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 ser
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:
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.
> -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
>
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 exactl
> 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 (
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 t
Hi all,
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
On Thu, 14 Mar 2002, Brad Harriger wrote:
>
> // 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 no
l 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:
MORE HTML CODE HERE
I have some code similar to
Is it legal for an if...else statement to span PHP code blocks? Here's
an example:
MORE HTML CODE HERE
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 u
30 matches
Mail list logo