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.
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
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
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
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
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 "";
if you paste the code that's causing the
problem, we can take a look.
Vlad
-Original Message-
From: Brad Harrig
26 matches
Mail list logo