Re: [PHP] DateTime... What else ?

2008-04-17 Thread Stut

On 17 Apr 2008, at 10:05, David BERCOT wrote:

I've got a problem with DateTime. I have a short code which gives an
error :

CODE
$date = new DateTime(date(d/m/Y));
$date-modify(-1 month);
$mois_en_cours1 = $date-format(Y-m);
$date-modify(-1 month);
$mois_en_cours2 = $date-format(Y-m);
$date-modify(-1 month);
$mois_en_cours3 = $date-format(Y-m);
/CODE

ERROR
bFatal error/b:  Class 'DateTime' not found in
b/var/www2/dacg_visio/index.html/b on line b244/bbr /
/ERROR

If I look at the documentation :
http://fr3.php.net/manual/fr/function.date-modify.php
it seems to work if PHP version is above 5.1.0 (I am in 5.1.6 !).

Do you have any idea about this error (Debian/Apache2) ?
Do you have another way to obtain $mois_en_cours1, 2, 3 without
DateTime ?


Pre-5.2 you need to explicitly say you want the DateTime class. See  
the note on this page: http://fr3.php.net/manual/fr/datetime.installation.php


Also note that it's experimental at the moment and therefore not  
recommended for production usage.


-Stut

--
http://stut.net/

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



Re: [PHP] DateTime... What else ?

2008-04-17 Thread Simon Welsh


On 17/04/2008, at 9:05, David BERCOT wrote:

Hi,

I've got a problem with DateTime. I have a short code which gives an
error :

CODE
$date = new DateTime(date(d/m/Y));
$date-modify(-1 month);
$mois_en_cours1 = $date-format(Y-m);
$date-modify(-1 month);
$mois_en_cours2 = $date-format(Y-m);
$date-modify(-1 month);
$mois_en_cours3 = $date-format(Y-m);
/CODE

ERROR
bFatal error/b:  Class 'DateTime' not found in
b/var/www2/dacg_visio/index.html/b on line b244/bbr /
/ERROR

If I look at the documentation :
http://fr3.php.net/manual/fr/function.date-modify.php
it seems to work if PHP version is above 5.1.0 (I am in 5.1.6 !).

Do you have any idea about this error (Debian/Apache2) ?
Do you have another way to obtain $mois_en_cours1, 2, 3 without
DateTime ?

Thank you very much.

David.


--  
PHP General Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php




?php
$mois_en_cours1 = date('Y-m', strtotime('-1 month'));
$mois_en_cours2 = date('Y-m', strtotime('-2 month'));
$mois_en_cours3 = date('Y-m', strtotime('-3 month'));
?

---
Simon Welsh
Admin of http://simon.geek.nz/

Windows is a joke operating system. Hell, it's not even an operating  
system. NT is Not Tough enough for me either. 95 is how may times it  
will crash an hour.


http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e



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



Re: [PHP] DateTime... What else ?

2008-04-17 Thread David BERCOT
Hi again,

Le Thu, 17 Apr 2008 21:10:44 +1200,
Simon Welsh [EMAIL PROTECTED] a écrit :
 On 17/04/2008, at 9:05, David BERCOT wrote:
  Hi,
 
  I've got a problem with DateTime. I have a short code which gives an
  error :
 
  CODE
  $date = new DateTime(date(d/m/Y));
  $date-modify(-1 month);
  $mois_en_cours1 = $date-format(Y-m);
  $date-modify(-1 month);
  $mois_en_cours2 = $date-format(Y-m);
  $date-modify(-1 month);
  $mois_en_cours3 = $date-format(Y-m);
  /CODE
 
  ERROR
  bFatal error/b:  Class 'DateTime' not found in
  b/var/www2/dacg_visio/index.html/b on line b244/bbr /
  /ERROR
 
  If I look at the documentation :
  http://fr3.php.net/manual/fr/function.date-modify.php
  it seems to work if PHP version is above 5.1.0 (I am in 5.1.6 !).
 
  Do you have any idea about this error (Debian/Apache2) ?
  Do you have another way to obtain $mois_en_cours1, 2, 3 without
  DateTime ?
 
  Thank you very much.
 
  David.
 
 ?php
 $mois_en_cours1 = date('Y-m', strtotime('-1 month'));
 $mois_en_cours2 = date('Y-m', strtotime('-2 month'));
 $mois_en_cours3 = date('Y-m', strtotime('-3 month'));
 ?

Great ;-)

Thank you very much !

David.


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



Re: [PHP] DateTime... What else ?

2008-04-17 Thread David BERCOT
Le Thu, 17 Apr 2008 10:19:10 +0100,
Stut [EMAIL PROTECTED] a écrit :
 On 17 Apr 2008, at 10:05, David BERCOT wrote:
  I've got a problem with DateTime. I have a short code which gives an
  error :
 
  CODE
  $date = new DateTime(date(d/m/Y));
  $date-modify(-1 month);
  $mois_en_cours1 = $date-format(Y-m);
  $date-modify(-1 month);
  $mois_en_cours2 = $date-format(Y-m);
  $date-modify(-1 month);
  $mois_en_cours3 = $date-format(Y-m);
  /CODE
 
  ERROR
  bFatal error/b:  Class 'DateTime' not found in
  b/var/www2/dacg_visio/index.html/b on line b244/bbr /
  /ERROR
 
  If I look at the documentation :
  http://fr3.php.net/manual/fr/function.date-modify.php
  it seems to work if PHP version is above 5.1.0 (I am in 5.1.6 !).
 
  Do you have any idea about this error (Debian/Apache2) ?
  Do you have another way to obtain $mois_en_cours1, 2, 3 without
  DateTime ?
 
 Pre-5.2 you need to explicitly say you want the DateTime class. See  
 the note on this page:
 http://fr3.php.net/manual/fr/datetime.installation.php
 
 Also note that it's experimental at the moment and therefore not  
 recommended for production usage.

OK. So, my error is normal !!!

Thank you very much.

David.


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



Re: [PHP] if then else statement not working

2005-05-09 Thread Deep
Hi,

Where are the dollar signs before seatnum, seat1 etc
in the if condition.

..Deeps..

--- Anasta [EMAIL PROTECTED] wrote:
 What am i doing wrong here, the output is always
 'empty'
 
 
 
 
 ?php
  $result = mysql_query(SELECT username FROM users
 WHERE seatnum='seat1') or die(mysql_error());
 
   if (seatnum == seat1) {
 echo username;
 } else {
 echo 'empty';
 }
 ?
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony

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



Re: [PHP] if then else

2005-05-06 Thread Richard Lynch
On Wed, May 4, 2005 12:20 am, Anasta said:
 Can anyone help with a statement, ive tried but it never works.
 I need to show a value if it is set to a specific value  ie:

 At the moment If a user is logs in a record is updated from 'away' to
 'online'---so i want an echo statement to show a value from another table
 if
 they are set to online or else they show another value.
 (2 seperate tables).

//This gets 'away' or 'online':
//(Or something like it in your tables)
$query = select status from whatever where username = '$username';
.
.
.

//Choose a table based on their logged in status:
if ($status == 'away'){
  $table = 'away_table';
}
else{
  $table = 'online_table';
}

//Now build a query with that table:
$query = select stuff from $table where username = '$username';


This is just ONE way of doing it.

Depending on your table structure, there could be other, better, faster
ways to do it.

We'd need to know more about the 'away' and 'online' table[s] and a bit
more info to really help you...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] if then else statement not working

2005-05-05 Thread bala chandar
On 5/5/05, Anasta [EMAIL PROTECTED] wrote:
 What am i doing wrong here, the output is always 'empty'
 
 ?php
  $result = mysql_query(SELECT username FROM users
 WHERE seatnum='seat1') or die(mysql_error());
 
   if (seatnum == seat1) {

you must use 

  if (seatnum == seat1) {

 echo username;
 } else {
 echo 'empty';
 }
 ?
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
bala balachandar muruganantham
blog lynx http://chandar.blogspot.com
web http://www.chennaishopping.com

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



Re: [PHP] if then else statement not working

2005-05-05 Thread Gabriel Guzman
Anasta wrote:
What am i doing wrong here, the output is always 'empty'

?php
 $result = mysql_query(SELECT username FROM users
WHERE seatnum='seat1') or die(mysql_error());
  if (seatnum == seat1) {
echo username;
} else {
echo 'empty';
}
?
mysql_query() returns a resource, not the results themselves.
read: http://us3.php.net/manual/en/function.mysql-query.php especially 
the 2nd example to see what else you need to do to get to your results.

hint:  mysql_fetch_assoc()
have fun,
gabe.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] if then else statement not working

2005-05-05 Thread Philip Hallstrom
What am i doing wrong here, the output is always 'empty'
?php
$result = mysql_query(SELECT username FROM users
WHERE seatnum='seat1') or die(mysql_error());
 if (seatnum == seat1) {
echo username;
} else {
echo 'empty';
}
?
Just guessing since I'm not sure what you're trying to do, but...
?php
$result = mysql_query(SELECT username FROM users WHERE seatnum='seat1')
  or die(mysql_error());
list($username) = mysql_fetch_array($result, MYSQL_NUM);
if ($seatnum == seat1) {
echo $username;
}else {
echo 'empty';
}
?
What I'm not seeing is where you set $seatnum in the first place and why 
you're doing the if/else at all since your mysql query will only return a 
username *if* seatnum='seat1' already so the above code I'm guessing will 
always print out $username (or blank if the query returns no results).

Anyway, the above should get you going in the right direction...
-philip
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] if then else statement not working

2005-05-05 Thread Rasmus Lerdorf
Anasta wrote:
 What am i doing wrong here, the output is always 'empty'
 
 ?php
  $result = mysql_query(SELECT username FROM users
 WHERE seatnum='seat1') or die(mysql_error());
 
   if (seatnum == seat1) {
 echo username;
 } else {
 echo 'empty';
 }
 ?

That doesn't even look like PHP code.  In PHP variables have $ in front
of them, and you are only sending a query, you aren't assignining
anything to the variables.  And further, your actual SQL query is
already applying that restriction, so any usernames returned by the
query will by definition have their seatnums be set to 'seat1' in the
database.

-Rasmus

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



Re: [PHP] if then else short form

2005-01-21 Thread Richard Davey
Hello Ben,

Friday, January 21, 2005, 12:01:09 PM, you wrote:

BE I seem to remember seing someone use a abreaviated form of a
BE if/them/else of the type that can be used in java.

BE It was something like

BE if ( a=b ) ? a=1 ; a=2;

BE Anybody know what the correct syntax is?

It's called a ternary operator.

$action = (empty($_POST['action'])) ? 'default' : $_POST['action'];

In the PHP manual under Comparison Operators.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde

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



Re: [PHP] if then else short form

2005-01-21 Thread Sergio Gorelyshev
On Fri, 21 Jan 2005 12:01:09 +
Ben Edwards [EMAIL PROTECTED] wrote:

 I seem to remember seing someone use a abreaviated form of a
 if/them/else of the type that can be used in java.
 
 It was something like
 
 if ( a=b ) ? a=1 ; a=2;
 
 Anybody know what the correct syntax is?

condition ? do_that_if_true : do_that_if_false;

 Ben
 -- 
 Ben Edwards - Poole, UK, England
 WARNING:This email contained partisan views - dont ever accuse me of
 using the veneer of objectivity
 If you have a problem emailing me use
 http://www.gurtlush.org.uk/profiles.php?uid=4
 (email address this email is sent from may be defunct)
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
RE5PECT
Sergio Gorelyshev

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



Re: [PHP] if then else short form

2005-01-21 Thread Jochem Maas
Ben Edwards wrote:
I seem to remember seing someone use a abreaviated form of a
if/them/else of the type that can be used in java.
It was something like
if ( a=b ) ? a=1 ; a=2;
$a = ($a == $b) ? 1: 2;
which meand: if $a is equal to $b then set $a to 1 otherwise set $a to 
2. that is equivalent to:

if ($a == $b) {
$a = 1;
} else {
$a = 1;
}
btw: its called the 'tertiary' syntax (because its the third form)
Anybody know what the correct syntax is?
Ben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] if then else short form

2005-01-21 Thread Jochem Maas
Ben Edwards wrote:
I seem to remember seing someone use a abreaviated form of a
if/them/else of the type that can be used in java.
It was something like
if ( a=b ) ? a=1 ; a=2;
I called it the 'tertiary' syntax which is not correct:
to quote a page I found: 
that the book refers to a tertiary operator, instead of a ternary 
operator. Of course, tertiary means third. Ternary means having 
three parts and is the correct way to describe the ?: operator. 
Alternatively, this operator could be described as trinary.


Anybody know what the correct syntax is?
Ben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] if then else short form

2005-01-21 Thread Manoj
 language tutorial (basic)...

if ( a=b ) ? a=1 ; a=2;
  a = a==b ? 1 : 2 ;
Cheer,
Manoj Kr. Sheoran 
Software Engg. 
Daffodil Software Ltd. 
web: www.daffodildb.com 
INDIA 






On Fri, 2005-01-21 at 17:31, Ben Edwards wrote:
 I seem to remember seing someone use a abreaviated form of a
 if/them/else of the type that can be used in java.
 
 It was something like
 
 if ( a=b ) ? a=1 ; a=2;
 
 Anybody know what the correct syntax is?
 
 Ben
 -- 
 Ben Edwards - Poole, UK, England
 WARNING:This email contained partisan views - dont ever accuse me of
 using the veneer of objectivity
 If you have a problem emailing me use
 http://www.gurtlush.org.uk/profiles.php?uid=4
 (email address this email is sent from may be defunct)

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



RE: [PHP] iguanahost - anyone else being plagued?

2004-09-15 Thread Gryffyn, Trevor
Yeah, I get tons of them too.  Ideally, someone should identify which
user subscribed to the list is the culprit and remove their address.

-TG

 -Original Message-
 From: Nick Wilson [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, September 15, 2004 11:53 AM
 To: php-general
 Subject: [PHP] iguanahost - anyone else being plagued?
 
 
 Anyone else getting these infuriating italian messages about 
 some muppet
 that doesnt exist?
 
 'desintione non existente'?
 
 I've written to [EMAIL PROTECTED] but no joy, everytime i 
 post on the
 php list i get half a dozen of the damn things...
 -- 
 Nick W
 
 -- 
 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] iguanahost - anyone else being plagued?

2004-09-15 Thread Jim Grill
 Anyone else getting these infuriating italian messages about some muppet
 that doesnt exist?

 'desintione non existente'?

 I've written to [EMAIL PROTECTED] but no joy, everytime i post on the
 php list i get half a dozen of the damn things...
 -- 
 Nick W


I've been getting those stupid things too. Is that Italian? I thought it was
Spanish. LOL

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



RE: [PHP] iguanahost - anyone else being plagued?

2004-09-15 Thread Vail, Warren
Could it be that lizards are nocturnal? ;-)

Warren Vail


-Original Message-
From: Jim Grill [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 15, 2004 10:05 AM
To: Nick Wilson; php-general
Subject: Re: [PHP] iguanahost - anyone else being plagued?


 Anyone else getting these infuriating italian messages about some 
 muppet that doesnt exist?

 'desintione non existente'?

 I've written to [EMAIL PROTECTED] but no joy, everytime i post on 
 the php list i get half a dozen of the damn things...
 --
 Nick W


I've been getting those stupid things too. Is that Italian? I thought it was
Spanish. LOL

-- 
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] iguanahost - anyone else being plagued?

2004-09-15 Thread Dan Joseph
I've done the same thing.  Most likely its an auto-response msg from them
after we reply to anything on this list.  I can't read the language its in
personally.  I wrote abuse several times, I get the same msg back.

-Dan Joseph

 -Original Message-
 From: Nick Wilson [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 15, 2004 11:53 AM
 To: php-general
 Subject: [PHP] iguanahost - anyone else being plagued?
 
 Anyone else getting these infuriating italian messages about some muppet
 that doesnt exist?
 
 'desintione non existente'?
 
 I've written to [EMAIL PROTECTED] but no joy, everytime i post on the
 php list i get half a dozen of the damn things...
 --
 Nick W
 
 --
 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] iguanahost - anyone else being plagued?

2004-09-15 Thread John Holmes
Subject: [PHP] iguanahost - anyone else being plagued?
I have a big lizard, if that helps. 

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


RE: [PHP] iguanahost - anyone else being plagued?

2004-09-15 Thread Gryffyn, Trevor
It appears to be a user not found type error..'desintione non
existente' looks a lot like destination doesn't exist.  The guys that
manage the PHP-General list need to be made aware so they can remove the
offending email address.  There's not a lot these iguana guys can do if
a user no longer exists on their system except to maybe ADD the account
back in so it doesn't return an autoresponder or something.

-TG

 -Original Message-
 From: Dan Joseph [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, September 15, 2004 1:37 PM
 To: 'php-general'
 Subject: RE: [PHP] iguanahost - anyone else being plagued?
 
 
 I've done the same thing.  Most likely its an auto-response 
 msg from them
 after we reply to anything on this list.  I can't read the 
 language its in
 personally.  I wrote abuse several times, I get the same msg back.
 
 -Dan Joseph
 
  -Original Message-
  From: Nick Wilson [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, September 15, 2004 11:53 AM
  To: php-general
  Subject: [PHP] iguanahost - anyone else being plagued?
  
  Anyone else getting these infuriating italian messages 
 about some muppet
  that doesnt exist?
  
  'desintione non existente'?
  
  I've written to [EMAIL PROTECTED] but no joy, everytime i 
 post on the
  php list i get half a dozen of the damn things...
  --
  Nick W
  
  --
  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
 
 

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



Re: [PHP] iguanahost - anyone else being plagued?

2004-09-15 Thread Ron Guerin
Gryffyn, Trevor wrote:
It appears to be a user not found type error..'desintione non
existente' looks a lot like destination doesn't exist.  The guys that
manage the PHP-General list need to be made aware so they can remove the
offending email address.  There's not a lot these iguana guys can do if
a user no longer exists on their system except to maybe ADD the account
back in so it doesn't return an autoresponder or something.

They're sending autoreplies to mailing list mail.  By definition, they've
got a problem to fix.
- Ron
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] iguanahost - anyone else being plagued?

2004-09-15 Thread Gryffyn, Trevor
Fair enough.

 -Original Message-
 From: Ron Guerin [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, September 15, 2004 3:04 PM
 To: Gryffyn, Trevor
 Cc: php-general; Dan Joseph
 Subject: Re: [PHP] iguanahost - anyone else being plagued?
 
 
 Gryffyn, Trevor wrote:
 
 It appears to be a user not found type error..'desintione non
 existente' looks a lot like destination doesn't exist.  
 The guys that
 manage the PHP-General list need to be made aware so they 
 can remove the
 offending email address.  There's not a lot these iguana 
 guys can do if
 a user no longer exists on their system except to maybe ADD 
 the account
 back in so it doesn't return an autoresponder or something.
 
 
 
 They're sending autoreplies to mailing list mail.  By 
 definition, they've
 got a problem to fix.
 
 - Ron
 

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



Re: [PHP] iguanahost - anyone else being plagued?

2004-09-15 Thread Nick Wilson

* and then Gryffyn, Trevor declared
 It appears to be a user not found type error..'desintione non

I must say, im glad it's not just me hehe! I was beginning to think it
was just me. I've been away from the list (never a big participant...)
for a while but stuff like that used got sorted faster...?

-- 
Nick W

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



RE: [PHP] iguanahost - anyone else being plagued?

2004-09-15 Thread David Robley
On Thu, 16 Sep 2004 04:14, Trevor Gryffyn wrote:

 It appears to be a user not found type error..'desintione non
 existente' looks a lot like destination doesn't exist.  The guys that
 manage the PHP-General list need to be made aware so they can remove the
 offending email address.  There's not a lot these iguana guys can do if
 a user no longer exists on their system except to maybe ADD the account
 back in so it doesn't return an autoresponder or something.

According to babelfish:

The Adressee who you attempt to contact no longer exists in our servants.
If it wishes but information iguanahosting.com writes to information @.
Excuse the disadvantages.

My hovercraft is full of eels??

Cheers
-- 
David Robley

Sleep is a poor substitute for caffeine.

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



Re: [PHP] If...Or...Else

2004-07-24 Thread Marcus Strube
 ?php
   if ((condition1 == TRUE) OR (condition2 == TRUE)) {
 do something;
   } esle {
 do something else;
   }
 ?

 What's the correct syntax for the If line?

if(true == condition1 || true == condition2) {
echo Hello World;
} else {
echo Best Regards;
}

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



Re: [PHP] Nested If...Else...

2004-07-24 Thread Scot L. Harris
On Sat, 2004-07-24 at 12:05, Robb Kerr wrote:
 What's wrong with this syntax. I just can't see my mistake.
 
 if ($vBkgrndImage == AnswerPage) {
   if ($vAnswerID_RS_PageContent != $row_RS_PageContent['CorrectAnswer']) {
 $vBkgrndImage = Bkgrnd-Body-Incorrect.jpg;
   } else {
 $vBkgrndImage = Bkgrnd-Body-Correct.jpg;
   }
 }
 
 Thanx

Single quotes around CorrectAnswer?

What is the error you are getting?

Guessing that if it passes the syntax checks I expect your problem is it
is always evaluating to one of the options and not the other.  
-- 
Scot L. Harris
[EMAIL PROTECTED]

Let not the sands of time get in your lunch. 

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



Re: [PHP] Nested If...Else...

2004-07-24 Thread Robb Kerr
On Sat, 24 Jul 2004 12:09:41 -0400, Scot L. Harris wrote:

 On Sat, 2004-07-24 at 12:05, Robb Kerr wrote:
 What's wrong with this syntax. I just can't see my mistake.
 
 if ($vBkgrndImage == AnswerPage) {
   if ($vAnswerID_RS_PageContent != $row_RS_PageContent['CorrectAnswer']) {
 $vBkgrndImage = Bkgrnd-Body-Incorrect.jpg;
   } else {
 $vBkgrndImage = Bkgrnd-Body-Correct.jpg;
   }
 }
 
 Thanx
 
 Single quotes around CorrectAnswer?
 
 What is the error you are getting?
 
 Guessing that if it passes the syntax checks I expect your problem is it
 is always evaluating to one of the options and not the other.

You've got it. Syntax passes checking - always returns..
 $vBkgrndImage = Bkgrnd-Body-Correct.jpg

Single quotes around 'CorectAnswer' is because that entry is in the style
of table_recordset['field']. How else should this be coded?

Thanx
-- 
Robb Kerr
Digital IGUANA

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



Re: [PHP] Nested If...Else...

2004-07-24 Thread Marek Kilimajer
Robb Kerr wrote:
On Sat, 24 Jul 2004 12:09:41 -0400, Scot L. Harris wrote:

On Sat, 2004-07-24 at 12:05, Robb Kerr wrote:
What's wrong with this syntax. I just can't see my mistake.
if ($vBkgrndImage == AnswerPage) {
 if ($vAnswerID_RS_PageContent != $row_RS_PageContent['CorrectAnswer']) {
   $vBkgrndImage = Bkgrnd-Body-Incorrect.jpg;
 } else {
   $vBkgrndImage = Bkgrnd-Body-Correct.jpg;
 }
}
Thanx
Single quotes around CorrectAnswer?
What is the error you are getting?
Guessing that if it passes the syntax checks I expect your problem is it
is always evaluating to one of the options and not the other.

You've got it. Syntax passes checking - always returns..
 $vBkgrndImage = Bkgrnd-Body-Correct.jpg
Single quotes around 'CorectAnswer' is because that entry is in the style
of table_recordset['field']. How else should this be coded?
Thanx
I think all column names are returned lowercased, so use 
$row_RS_PageContent['correctanswer']

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


Re: [PHP] Nested If...Else...

2004-07-24 Thread Robb Kerr
On Sat, 24 Jul 2004 18:18:23 +0200, Marek Kilimajer wrote:

 Robb Kerr wrote:
 On Sat, 24 Jul 2004 12:09:41 -0400, Scot L. Harris wrote:
 
 
On Sat, 2004-07-24 at 12:05, Robb Kerr wrote:

What's wrong with this syntax. I just can't see my mistake.

if ($vBkgrndImage == AnswerPage) {
  if ($vAnswerID_RS_PageContent != $row_RS_PageContent['CorrectAnswer']) {
$vBkgrndImage = Bkgrnd-Body-Incorrect.jpg;
  } else {
$vBkgrndImage = Bkgrnd-Body-Correct.jpg;
  }
}

Thanx

Single quotes around CorrectAnswer?

What is the error you are getting?

Guessing that if it passes the syntax checks I expect your problem is it
is always evaluating to one of the options and not the other.
 
 
 You've got it. Syntax passes checking - always returns..
  $vBkgrndImage = Bkgrnd-Body-Correct.jpg
 
 Single quotes around 'CorectAnswer' is because that entry is in the style
 of table_recordset['field']. How else should this be coded?
 
 Thanx
 
 I think all column names are returned lowercased, so use 
 $row_RS_PageContent['correctanswer']

Nope. That just changed the return to always be the other option.
-- 
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams

http://www.digitaliguana.com
http://www.cancerreallysucks.org

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



Re: [PHP] Nested If...Else...

2004-07-24 Thread Robb Kerr
On Sat, 24 Jul 2004 12:09:41 -0400, Scot L. Harris wrote:

 On Sat, 2004-07-24 at 12:05, Robb Kerr wrote:
 What's wrong with this syntax. I just can't see my mistake.
 
 if ($vBkgrndImage == AnswerPage) {
   if ($vAnswerID_RS_PageContent != $row_RS_PageContent['CorrectAnswer']) {
 $vBkgrndImage = Bkgrnd-Body-Incorrect.jpg;
   } else {
 $vBkgrndImage = Bkgrnd-Body-Correct.jpg;
   }
 }
 
 Thanx
 
 Single quotes around CorrectAnswer?
 
 What is the error you are getting?
 
 Guessing that if it passes the syntax checks I expect your problem is it
 is always evaluating to one of the options and not the other.

To eliminate the single quotes in the IF statement I altered the code like
this...

$vPageContentCorrectAnswer = $row_RS_PageContent['CorrectAnswer'];
if ($vBkgrndImage == AnswerPage) {
  if ($vPageContentCorrectAnswer != $vAnswerID_RS_PageContent) {
$vBkgrndImage = Bkgrnd-Body-Incorrect.jpg;
  } else {
$vBkgrndImage = Bkgrnd-Body-Correct.jpg;
  }
}

It still works the same. What's the deal?
-- 
Robb Kerr
Digital IGUANA

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



Re: [PHP] Nested If...Else...

2004-07-24 Thread Jason Davidson
print out all the values of the vars your comparing often youll
find one of them is not what your expecting

Jason

On Sat, 24 Jul 2004 11:05:06 -0500, Robb Kerr
[EMAIL PROTECTED] wrote:
 What's wrong with this syntax. I just can't see my mistake.
 
 if ($vBkgrndImage == AnswerPage) {
   if ($vAnswerID_RS_PageContent != $row_RS_PageContent['CorrectAnswer']) {
 $vBkgrndImage = Bkgrnd-Body-Incorrect.jpg;
   } else {
 $vBkgrndImage = Bkgrnd-Body-Correct.jpg;
   }
 }
 
 Thanx
 --
 Robb Kerr
 Digital IGUANA
 Helping Digital Artists Achieve their Dreams
 
 http://www.digitaliguana.com
 http://www.cancerreallysucks.org
 
 --
 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] Nested If...Else...

2004-07-24 Thread Matthew Sims
 What's wrong with this syntax. I just can't see my mistake.

 if ($vBkgrndImage == AnswerPage) {
   if ($vAnswerID_RS_PageContent != $row_RS_PageContent['CorrectAnswer']) {
 $vBkgrndImage = Bkgrnd-Body-Incorrect.jpg;
   } else {
 $vBkgrndImage = Bkgrnd-Body-Correct.jpg;
   }
 }

 Thanx
 --
 Robb Kerr

I can't see anything wrong. What's the error you're receiving?

-- 
--Matthew Sims
--http://killermookie.org

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



Re: [PHP] Nested If...Else...

2004-07-24 Thread Matthew Sims
 print out all the values of the vars your comparing often youll
 find one of them is not what your expecting

 Jason

 On Sat, 24 Jul 2004 11:05:06 -0500, Robb Kerr
 [EMAIL PROTECTED] wrote:
 What's wrong with this syntax. I just can't see my mistake.

 if ($vBkgrndImage == AnswerPage) {
   if ($vAnswerID_RS_PageContent != $row_RS_PageContent['CorrectAnswer'])
 {
 $vBkgrndImage = Bkgrnd-Body-Incorrect.jpg;
   } else {
 $vBkgrndImage = Bkgrnd-Body-Correct.jpg;
   }
 }

 Thanx
 --
 Robb Kerr

Yes, see what the vars are, maybe something like this:

if ($vBkgrndImage == AnswerPage) {
  echo 1: $vAnswerID_RS_PageContentbr;
  echo 2:.$row_RS_PageContent['CorrectAnswer'].br;
}

Then look on your page for the numbers 1 and 2 and see if the vars are
what you're expecting.

-- 
--Matthew Sims
--http://killermookie.org

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



Re: [PHP] Nested If...Else...

2004-07-24 Thread Robb Kerr
On Sat, 24 Jul 2004 09:47:52 -0700 (PDT), Matthew Sims wrote:

 What's wrong with this syntax. I just can't see my mistake.

 if ($vBkgrndImage == AnswerPage) {
   if ($vAnswerID_RS_PageContent != $row_RS_PageContent['CorrectAnswer']) {
 $vBkgrndImage = Bkgrnd-Body-Incorrect.jpg;
   } else {
 $vBkgrndImage = Bkgrnd-Body-Correct.jpg;
   }
 }

 Thanx
 --
 Robb Kerr
 
 I can't see anything wrong. What's the error you're receiving?

$vBkgrndImage = Bkgrnd-Body-Incorrect whether $vAnswerID_RS_PageContent
equals $row_RS_PageContent['CorrectAnswer'] or not. I've added printouts of
my variables to the bottom of the page so that I can check their content.
And even when both associated variables match, Bkgrnd-Body-Incorrect is
returned.
-- 
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams

http://www.digitaliguana.com
http://www.cancerreallysucks.org

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



Re: [PHP] Nested If...Else...

2004-07-24 Thread Stan F
Try this:

echo pre;
print_r( variable_you_wanna_track );
echo /pre;

The output will be easy-readable. Or try var_dump().
This helps maintaining scripts in more pleasant way.

- Original Message -
From: Robb Kerr [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, July 24, 2004 8:49 PM
Subject: Re: [PHP] Nested If...Else...


 On Sat, 24 Jul 2004 09:47:52 -0700 (PDT), Matthew Sims wrote:

  What's wrong with this syntax. I just can't see my mistake.
 
  if ($vBkgrndImage == AnswerPage) {
if ($vAnswerID_RS_PageContent !=
$row_RS_PageContent['CorrectAnswer']) {
  $vBkgrndImage = Bkgrnd-Body-Incorrect.jpg;
} else {
  $vBkgrndImage = Bkgrnd-Body-Correct.jpg;
}
  }
 
  Thanx
  --
  Robb Kerr
 
  I can't see anything wrong. What's the error you're receiving?

 $vBkgrndImage = Bkgrnd-Body-Incorrect whether $vAnswerID_RS_PageContent
 equals $row_RS_PageContent['CorrectAnswer'] or not. I've added printouts
of
 my variables to the bottom of the page so that I can check their content.
 And even when both associated variables match, Bkgrnd-Body-Incorrect is
 returned.
 --
 Robb Kerr
 Digital IGUANA
 Helping Digital Artists Achieve their Dreams
 
 http://www.digitaliguana.com
 http://www.cancerreallysucks.org

 --
 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] Nested If...Else...

2004-07-24 Thread Robb Kerr
On Sat, 24 Jul 2004 12:09:41 -0400, Scot L. Harris wrote:

 On Sat, 2004-07-24 at 12:05, Robb Kerr wrote:
 What's wrong with this syntax. I just can't see my mistake.
 
 if ($vBkgrndImage == AnswerPage) {
   if ($vAnswerID_RS_PageContent != $row_RS_PageContent['CorrectAnswer']) {
 $vBkgrndImage = Bkgrnd-Body-Incorrect.jpg;
   } else {
 $vBkgrndImage = Bkgrnd-Body-Correct.jpg;
   }
 }
 
 Thanx
 
 Single quotes around CorrectAnswer?
 
 What is the error you are getting?
 
 Guessing that if it passes the syntax checks I expect your problem is it
 is always evaluating to one of the options and not the other.

Sorry everyone. Found the problem. Thanx for all your trying. The problem
was a stupid error on my part - which they usually are.

The syntax of the IF statement was correct. I had the $_GET statement which
defined $vAnswer_ID_RS_PageContent below the IF in the script. Both of
these elements are in the HEAD so the display of the variables are below
this in the BODY. So, I was seeing variables containing the correct
values, but when the IF was executed, $vAnswer_ID_RS_PageContent had not
yet been defined.

Thanx again for your help.
-- 
Robb Kerr
Digital IGUANA

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



Re: [PHP] if/elseif/else v. switch

2004-06-05 Thread Curt Zirzow
* Thus wrote Dennis Seavers ([EMAIL PROTECTED]):
 Is there any noticeable difference (on the part of the client)
 ...

The only time the client will perhaps notice a difference is if
your condition is in a loop that cycles a couple thousand times or
more.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



RE: [PHP] hmm.. anyone else get a friendly message from Kenneth Uzzi?!

2003-12-04 Thread Jay Blanchard
[snip]
Hmm.. I swear I get more spam and crap-mail thanks to posting to this
list than from anywhere else! Did anyone else get a wonderfully
abusive message from one bonehead kenneth uzzi
[EMAIL PROTECTED]? as a result of posting here?
[/snip]

Nope, but I am getting some bounces from others

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



Re: [PHP] Is anybody else getting these??

2003-10-20 Thread David T-G
John, et al --

...and then John Nichel said...
% 
% Does [EMAIL PROTECTED] need to be removed from the list, or is it 
% just me?

I get nothing from Maurice, but Fabio Farinelli keeps sending me a note
whenever I post.


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Is anybody else getting these??

2003-10-20 Thread John Nichel
David T-G wrote:
John, et al --

...and then John Nichel said...
% 
% Does [EMAIL PROTECTED] need to be removed from the list, or is it 
% just me?

I get nothing from Maurice, but Fabio Farinelli keeps sending me a note
whenever I post.
HTH  HAND

:-D
I recently moved my webserver / mailserver from a hosting company to my 
house, on a dynamic IP address.  By doing that, certain ISP's block my 
emails (AOL, RoadRunner, etc.), so I'm just trying to make sure the 
problem with 'Maurice' isn't on my end.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Is anybody else getting these??

2003-10-20 Thread Jon Kriek
 Fabio Farinelli keeps sending me a note whenever I post.

Indeed, same here.

-- 
Jon Kriek
http://phpfreaks.com

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



Re: [PHP] Is anybody else getting these??

2003-10-20 Thread Nicholas Robinson
I'm feeling left out, I'm not getting any of these. Haven't done since I 
blocked Hanmir.

On Monday 20 Oct 2003 4:11 pm, John Nichel wrote:
 Does [EMAIL PROTECTED] need to be removed from the list, or is it
 just me?

  Original Message 
 Subject: Returned mail: see transcript for details (Re: [PHP] PHP manual
 - multiple HTML pages)
 Date: 20 Oct 03 1459 GMT
 From: Mailer Daemon [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]



 - The following addresses had permanent fatal errors -
 wim
  (reason: 550 Recipient wim is no user here)


 - Transcript of session follows -

 .. while talking to smtp.:
  RCPT To:wim

  550 Recipient wim is no user here
 550 5.1.1 wim... User unknown


 - Transcript of mail follows -
 Received: from pb1.pair.com (pb1.pair.com [216.92.131.4])
   by digtechinc.com (8.9.3/8.9.3) with SMTP id KAA20908
   for [EMAIL PROTECTED]; Mon, 20 Oct 2003 10:58:47 -0400 (EDT)
 Received: (qmail 61526 invoked by uid 1010); 20 Oct 2003 14:58:11 -
 Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
 Precedence: bulk
 list-help: mailto:[EMAIL PROTECTED]
 list-unsubscribe: mailto:[EMAIL PROTECTED]
 list-post: mailto:[EMAIL PROTECTED]
 Delivered-To: mailing list [EMAIL PROTECTED]
 Received: (qmail 61513 invoked by uid 1010); 20 Oct 2003 14:58:11 -
 Delivered-To: [EMAIL PROTECTED]
 Delivered-To: [EMAIL PROTECTED]
 Message-ID: [EMAIL PROTECTED]
 Date: Mon, 20 Oct 2003 10:00:35 -0500
 From: John Nichel [EMAIL PROTECTED]
 Organization: By-Tor.com
 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4)
 Gecko/20030624 Netscape/7.1 (ax)
 X-Accept-Language: en-us, en
 MIME-Version: 1.0
 To: wim [EMAIL PROTECTED]
 CC: [EMAIL PROTECTED]
 References: [EMAIL PROTECTED]
 In-Reply-To: [EMAIL PROTECTED]
 Content-Type: text/plain; charset=us-ascii; format=flowed
 Content-Transfer-Encoding: 7bit
 Subject: Re: [PHP] PHP manual - multiple HTML pages
 X-UIDL: 9622b9dae1c0a3c1401061ad550b17bb


 X-Bounce: msd

 wim wrote:
  Does anyone still have the tarfile for the manual. On the website they
  announce that these manuals will be redeployed shortly but this message
  is already three weeks there and I need this (as always ) urgently.
  Thanx in advance for sending it .
 
  Wim

 Best I have is a copy that was last updated on Dec 10, 2002...

 http://www.by-tor.com/php_manual.tar.bz2

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



Re: [PHP] WHILE IF/ELSE loop not working

2003-01-24 Thread Rick Emery
Define fails
- Original Message - 
From: Jay Fitzgerald [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, January 24, 2003 3:11 PM
Subject: [PHP] WHILE IF/ELSE loop not working


can anyone tell me why this while loop fails?

==
while ($row = mysql_fetch_array($sql_result)):
$phone = $row[phone];
$date = $row[date];
if ($phone == $_POST[areacode]$_POST[prefix]$_POST[suffix]):

if ($date == NULL):
$date = today;
echo BICongratulations!/B/I

P
B$_POST[areacode]-$_POST[prefix]-$_POST[suffix]/B is qualified with 
an available date of nbsp;B$date/B.
;

elseif ($date != NULL):
echo BICongratulations!/I/B

P
B$_POST[areacode]-$_POST[prefix]-$_POST[suffix]/B is qualified with 
a first available date of nbsp;B$date/B.
;

else:
echo BSorry! $_POST[areacode]-$_POST[prefix]-$_POST[suffix]/B is 
not available at this time.;
endif;
endif;
endwhile;
==



-- 
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] WHILE IF/ELSE loop not working

2003-01-24 Thread Jason Wong
On Saturday 25 January 2003 05:43, Rick Emery wrote:
 Define fails
 - Original Message -
 From: Jay Fitzgerald [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, January 24, 2003 3:11 PM
 Subject: [PHP] WHILE IF/ELSE loop not working


 can anyone tell me why this while loop fails?

When you go to your doctor you usually give him/her a head start by telling 
him/her what you feel is wrong with you. You don't go in and say What is 
wrong with me?.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Ha.  For once you're both wrong but not where you are thinking.

- Larry McVoy to Linus Torvalds on linux-kernel
*/


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




RE: [PHP] if elseif else

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

You can use as many elseifs as you need.  I'm not sure how it affects
performance, but it works (I have one that goes through all 50 states).

-Natalie

-Original Message-
From: Gerard Samuel [mailto:[EMAIL PROTECTED]] 
Sent: Friday, April 19, 2002 10:02 AM
To: PHP
Subject: [PHP] if elseif else


I redoing some code, and the original author has code like

if
elseif
elseif
elseif
else

I have always known it to have just one elseif, not multiple ones. I was
going to move it to a switch/case, but there is no common switch. So I
wanted to know if its technically ok, or just ok to use multiple elseif

Thanks


-- 
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 elseif else

2002-04-19 Thread The_RadiX

Nope..

That is fine..


I use it all the time.. It's quite acceptable..




- Original Message -
From: Gerard Samuel [EMAIL PROTECTED]
To: PHP [EMAIL PROTECTED]
Sent: Saturday, April 20, 2002 12:01 AM
Subject: [PHP] if elseif else


 I redoing some code, and the original author has code like

 if
 elseif
 elseif
 elseif
 else

 I have always known it to have just one elseif, not multiple ones.
 I was going to move it to a switch/case, but there is no common switch.
 So I wanted to know if its technically ok, or just ok to use multiple
elseif

 Thanks


 --
 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] elseif without else

2002-02-28 Thread Jeff Sheltren

If you are setting a variable inside of the if statements, and then 
checking that variable later, then I would say you should either use an 
else statement to give that variable a default value, or you should set the 
variable to a default value before the if statements  Your code is 
legitimate, ie there is no reason you *have* to have an else statement

Jeff

At 07:32 PM 2/28/2002 -0500, Erik Price wrote:
For any of you PHP legal eagles:

I rtfm'd, but the elseif page doesn't say -- is it okay to have

if ($x) {
// do something
} elseif  ($y) {
// do something
} elseif ($z) {
// do something
}

without a final else?  My code works fine -- so I know that you -can- do 
this  What I was wondering is if this is something that is likely to get 
deprecated at some point in the future  IOW, is it legitimate, 
regardless of how it works?


Thanks,

Erik

PS: is it bad coding style to do the above?  I'd like comments on that too 
if applicable  My if statements check for conditions and then set a 
variable, and later in the script if that variable exists then something 
else happens  Is this sloppy?




-- 
PHP General Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




Re: [PHP] elseif without else

2002-02-28 Thread Dennis Moore

Perfectly legitimate... it is much like having a switch statement without a
default clause.





- Original Message -
From: Erik Price [EMAIL PROTECTED]
To: PHP (E-mail) [EMAIL PROTECTED]
Sent: Thursday, February 28, 2002 7:32 PM
Subject: [PHP] elseif without else


 For any of you PHP legal eagles:

 I rtfm'd, but the elseif page doesn't say -- is it okay to have

 if ($x) {
 // do something
 } elseif  ($y) {
 // do something
 } elseif ($z) {
 // do something
 }

 without a final else?  My code works fine -- so I know that you -can-
 do this.  What I was wondering is if this is something that is likely to
 get deprecated at some point in the future.  IOW, is it legitimate,
 regardless of how it works?


 Thanks,

 Erik

 PS: is it bad coding style to do the above?  I'd like comments on that
 too if applicable.  My if statements check for conditions and then set a
 variable, and later in the script if that variable exists then something
 else happens.  Is this sloppy?





 

 Erik Price
 Web Developer Temp
 Media Lab, H.H. Brown
 [EMAIL PROTECTED]


 --
 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] elseif without else

2002-02-28 Thread Martin Towell

if there's nothing to do in the else block, then it's a bit pointless to
have one
eg
input type=checkbox? if ($blah)  echo  checked; ? value=xxx
name=blah
see what I mean?

Martin

-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 01, 2002 11:32 AM
To: PHP
Subject: [PHP] elseif without else


For any of you PHP legal eagles:

I rtfm'd, but the elseif page doesn't say -- is it okay to have

if ($x) {
// do something
} elseif  ($y) {
// do something
} elseif ($z) {
// do something
}

without a final else?  My code works fine -- so I know that you -can- 
do this.  What I was wondering is if this is something that is likely to 
get deprecated at some point in the future.  IOW, is it legitimate, 
regardless of how it works?


Thanks,

Erik

PS: is it bad coding style to do the above?  I'd like comments on that 
too if applicable.  My if statements check for conditions and then set a 
variable, and later in the script if that variable exists then something 
else happens.  Is this sloppy?







Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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



Re: [PHP] elseif without else

2002-02-28 Thread Erik Price


On Thursday, February 28, 2002, at 07:56  PM, Dennis Moore wrote:

 Perfectly legitimate... it is much like having a switch statement 
 without a
 default clause.



Oh, I didn't know that that was legitimate either.  :)  Thanks Dennis


Erik



Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




RE: [PHP] Can If Else statements be split into code blocks??

2001-11-13 Thread Richard Black

Try putting curly brackets around the if and else clauses. I'm guessing the 
embeded html form counts as another statement in the program, which means 
you want to execute 2 statements if the strstr is true. I ALWAYS use curly 
brackets, even if I'm only executing one statemenet in my if, and I've 
never had problems with stuff like this.
So...

?php
if (strstr($DomResults,$Match))  {
print Congratulations!  $domain.$suffix is available!;
?
form method=POST action=step2.asp name=form2
  pinput type=submit value=Register name=B1/p
/form

?php
  }
   else  {
print Sorry, $domain.$suffix is already taken.;
}
?

Should hopefully work...

Richy

-Original Message-
From:   Brad Melendy [SMTP:[EMAIL PROTECTED]]
Sent:   13 November 2001 09:16
To: [EMAIL PROTECTED]
Subject:[PHP] Can If Else statements be split into code blocks??

Hello,
I'm trying to execute some HTML in an IF ELSE statement.  I'm trying
something like:

?php
if (strstr($DomResults,$Match))
print Congratulations!  $domain.$suffix is available!;
?
form method=POST action=step2.asp name=form2
  pinput type=submit value=Register name=B1/p
/form

?php
   else
print Sorry, $domain.$suffix is already taken.;
?

Basically, it works great without the form I'm trying to insert, but with
the form after the IF statement, it fails.  Is what I want to do against 
the
rules?  I'm converting an ASP script I have to PHP and I have it all 
working
under ASP.  That means it should be eaiser with PHP right?  ;-)  Thanks in
advance.

...Brad



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Is anyone else seeing this everytime they mail to the list?

2001-09-21 Thread Jason Bell

Hmmm  Well, the *ONLY* time I get it is when I send email to
php-general


NoWayMan [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hey I got that message in trying to remove my address from a spammer's
 list. But I'm not subscribed to the php mailing list.






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Is anyone else seeing this everytime they mail to the list?

2001-09-21 Thread Sheridan Saint-Michel

I have also gotten that message when sending to PHP General.  I had
cc'ed the original author, though, so thought maybe they had a misconfigured
reply to addy.

This is probably not the case, however, as the e-mail addy listed in my
bounce message was the same as the one you have listed here.
(Unless you got this message when CC'ing Wee Chua)

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: Jason Bell [EMAIL PROTECTED]
To: PHP Users [EMAIL PROTECTED]
Sent: Friday, September 21, 2001 12:24 PM
Subject: Re: [PHP] Is anyone else seeing this everytime they mail to the
list?


 Hmmm  Well, the *ONLY* time I get it is when I send email to
 php-general


 NoWayMan [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hey I got that message in trying to remove my address from a spammer's
  list. But I'm not subscribed to the php mailing list.
 
 

 


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Is anyone else seeing this everytime they mail to the list?

2001-09-21 Thread Sheridan Saint-Michel

Hmmm... I got the same bounce message when I sent this message.

- Original Message -
From: Sheridan Saint-Michel [EMAIL PROTECTED]
To: Jason Bell [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, September 21, 2001 1:24 PM
Subject: Re: [PHP] Is anyone else seeing this everytime they mail to the
list?


 I have also gotten that message when sending to PHP General.  I had
 cc'ed the original author, though, so thought maybe they had a
misconfigured
 reply to addy.

 This is probably not the case, however, as the e-mail addy listed in my
 bounce message was the same as the one you have listed here.
 (Unless you got this message when CC'ing Wee Chua)

 Sheridan Saint-Michel
 Website Administrator
 FoxJet, an ITW Company
 www.foxjet.com


 - Original Message -
 From: Jason Bell [EMAIL PROTECTED]
 To: PHP Users [EMAIL PROTECTED]
 Sent: Friday, September 21, 2001 12:24 PM
 Subject: Re: [PHP] Is anyone else seeing this everytime they mail to the
 list?


  Hmmm  Well, the *ONLY* time I get it is when I send email to
  php-general
 
 
  NoWayMan [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Hey I got that message in trying to remove my address from a spammer's
   list. But I'm not subscribed to the php mailing list.
  
  
 
  
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Is anyone else seeing this everytime they mail to the list?

2001-09-21 Thread Jason Bell

Nope. I get it even if php-general is the only address I'm emailing..


- Original Message -
From: Sheridan Saint-Michel [EMAIL PROTECTED]
To: Jason Bell [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, September 21, 2001 11:24 AM
Subject: Re: [PHP] Is anyone else seeing this everytime they mail to the
list?


 I have also gotten that message when sending to PHP General.  I had
 cc'ed the original author, though, so thought maybe they had a
misconfigured
 reply to addy.

 This is probably not the case, however, as the e-mail addy listed in my
 bounce message was the same as the one you have listed here.
 (Unless you got this message when CC'ing Wee Chua)

 Sheridan Saint-Michel
 Website Administrator
 FoxJet, an ITW Company
 www.foxjet.com


 - Original Message -
 From: Jason Bell [EMAIL PROTECTED]
 To: PHP Users [EMAIL PROTECTED]
 Sent: Friday, September 21, 2001 12:24 PM
 Subject: Re: [PHP] Is anyone else seeing this everytime they mail to the
 list?


  Hmmm  Well, the *ONLY* time I get it is when I send email to
  php-general
 
 
  NoWayMan [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Hey I got that message in trying to remove my address from a spammer's
   list. But I'm not subscribed to the php mailing list.
  
  
 
  
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] if then else?

2001-08-18 Thread Glyndower

btw...this is the code i'm trying

Please keep the laughter to a minimum...ah heck with it...laugh all you
want...its good for ya


?php if ($prof_exp_1 = not null) { ?
H4Professional Experience: /H4li
?php printf(mysql_result($result,0,prof_exp_1)); ?br
?php } else if ($prof_exp_1 = null) {?
This field is empty
?php } else {?
output for users with a variable other than value1 or value2
?php }; ?

?php if ($prof_exp_2 = not null) { ?
li
?php printf(mysql_result($result,0,prof_exp_2)); ?br
?php } else if ($prof_exp_1 = null) {?
This field is empty
?php } else {?
output for users with a variable other than value1 or value2
?php }; ?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] IF ELSEIF ELSE??

2001-08-03 Thread Richard Baskett

if (!$HTTP_POST_VARS) exit();
else {
  if (!$Age)   { echo Please enter your age.br\n; }
  if (!$Email) { echo Please enter your email.br\n; }
  if (!$State) { echo Please enter your Location.br\n;}
  if ($Age  $Email  $State) echo Thanks for your submission.;
}

Your if and else statements used every possibility up, so that last else
will never get hit.  There are a lot of things you can do better with the
above code, but it'll do what you want.  For example something you might
want to look at the type of data the person is entering, a little
validation.  I hope that helps.

Rick

 Whats wrong with this piece of code.  Basically, it not doing the last
 else statement.
 1.  If no form was submitted exit.
 2.  If a form was submitted, check for 'empty' strings.
 3.  If all is good, echo x;
 
 Thanks all.
 
 
 
 if (!$HTTP_POST_VARS) { exit(); }
 elseif ($HTTP_POST_VARS) {
 if (!$Age) { echo Please enter your age.br\n; }
if 
 (!$Email) { echo Please enter your email.br\n; }
 if (!$State) { echo Please enter your Location.br\n;}
 }
 else
 echo Thanks for your submission.;


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re:[PHP] IF ELSEIF ELSE??

2001-08-03 Thread Jack Sasportas

First you should manage your code nicer so that it is easier to read
and troubleshoot.  Go through this to find my notes...

if (!$HTTP_POST_VARS) { exit();}
elseif ($HTTP_POST_VARS) {
if (!$Age) { echo Please enter your age.br\n;
} if

Why would you use elseif above ? you are asking the full question in
the first line
if (!$HTTP_POST_VARS) { exit();}

if it's NOT then why say elseif, it's else, it's either one or the
other...that's one thing.

so lets change it to this:
if (!$HTTP_POST_VARS) {
exit();
} else {
if (!$Age) {
echo Please enter your age.br\n;
}

if (!$Email) {
echo Please enter your email.br\n;
}

if (!$State) {
echo Please enter your Location.br\n;
}

(MARK)
} else ( RIGHT HERE YOU DID NOT OPEN THE REST OF THE ELSE )
echo Thanks for your submission.;

( RIGHT HERE YOU DID NOT CLSE THEN END OF THE CONDITION )


so the last lines replacing after (MARK) should look like this

} else {
echo Thanks for your submission.;
}


As you can see keeping the code in this format makes it a lot easier to
see what is being exectued within the condition, allows you to see the
open  closes of the brackets, and should have easily let you see you
were missing something.


Hope that explains it



Re: [PHP] Re:[PHP] IF ELSEIF ELSE??

2001-08-03 Thread Richard Baskett

Just curious but that last else you told him to put in... what is that
referring to?  There is already an else statement, you can't have another.
Unless you're putting the else statement after the if (!$State) which you
would need to subtract the } before the else, but this would give you
undesired results since this is just an else for the !$State statement.

I could be missing what you were getting at.. it's definitely possible :)

Rick


 First you should manage your code nicer so that it is easier to read
 and troubleshoot.  Go through this to find my notes...
 
 if (!$HTTP_POST_VARS) { exit();}
 elseif ($HTTP_POST_VARS) {
 if (!$Age) { echo Please enter your age.br\n;
 } if
 
 Why would you use elseif above ? you are asking the full question in
 the first line
 if (!$HTTP_POST_VARS) { exit();}
 
 if it's NOT then why say elseif, it's else, it's either one or the
 other...that's one thing.
 
 so lets change it to this:
 if (!$HTTP_POST_VARS) {
 exit();
 } else {
 if (!$Age) {
 echo Please enter your age.br\n;
 }
 
 if (!$Email) {
 echo Please enter your email.br\n;
 }
 
 if (!$State) {
 echo Please enter your Location.br\n;
 }
 
 (MARK)
 } else ( RIGHT HERE YOU DID NOT OPEN THE REST OF THE ELSE )
 echo Thanks for your submission.;
 
 ( RIGHT HERE YOU DID NOT CLSE THEN END OF THE CONDITION )
 
 
 so the last lines replacing after (MARK) should look like this
 
 } else {
 echo Thanks for your submission.;
 }
 
 
 As you can see keeping the code in this format makes it a lot easier to
 see what is being exectued within the condition, allows you to see the
 open  closes of the brackets, and should have easily let you see you
 were missing something.
 
 
 Hope that explains it
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re:[PHP] IF ELSEIF ELSE??

2001-08-03 Thread Jack Sasportas

Yes, I see what you mean...
In showing why the last section didn't work, I messed up the actual
overall
logic of the code.
I should have noticed that...nice catch

so for clarification where it says (MARK) should be
echo Thanks for your submission.;
}

Thanks...

Jack Sasportas wrote:

 Yes, I see what you mean...
 In showing why the last section didn't work, I messed up the actual overall
 logic of the code.
 I should have noticed that...nice catch

 so for clarification where it says (MARK) should be
 echo Thanks for your submission.;
 }

 Thanks...

 Richard Baskett wrote:

  Just curious but that last else you told him to put in... what is that
  referring to?  There is already an else statement, you can't have another.
  Unless you're putting the else statement after the if (!$State) which you
  would need to subtract the } before the else, but this would give you
  undesired results since this is just an else for the !$State statement.
 
  I could be missing what you were getting at.. it's definitely possible :)
 
  Rick
 
   First you should manage your code nicer so that it is easier to read
   and troubleshoot.  Go through this to find my notes...
  
   if (!$HTTP_POST_VARS) { exit();}
   elseif ($HTTP_POST_VARS) {
   if (!$Age) { echo Please enter your age.br\n;
   } if
  
   Why would you use elseif above ? you are asking the full question in
   the first line
   if (!$HTTP_POST_VARS) { exit();}
  
   if it's NOT then why say elseif, it's else, it's either one or the
   other...that's one thing.
  
   so lets change it to this:
   if (!$HTTP_POST_VARS) {
   exit();
   } else {
   if (!$Age) {
   echo Please enter your age.br\n;
   }
  
   if (!$Email) {
   echo Please enter your email.br\n;
   }
  
   if (!$State) {
   echo Please enter your Location.br\n;
   }
  
   (MARK)
   } else ( RIGHT HERE YOU DID NOT OPEN THE REST OF THE ELSE )
   echo Thanks for your submission.;
  
   ( RIGHT HERE YOU DID NOT CLSE THEN END OF THE CONDITION )
  
  
   so the last lines replacing after (MARK) should look like this
  
   } else {
   echo Thanks for your submission.;
   }
  
  
   As you can see keeping the code in this format makes it a lot easier to
   see what is being exectued within the condition, allows you to see the
   open  closes of the brackets, and should have easily let you see you
   were missing something.
  
  
   Hope that explains it
  
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 ___
 Jack Sasportas
 Innovative Internet Solutions
 Phone 305.665.2500
 Fax 305.665.2551
 www.innovativeinternet.com
 www.web56.net

--
___
Jack Sasportas
Innovative Internet Solutions
Phone 305.665.2500
Fax 305.665.2551
www.innovativeinternet.com
www.web56.net




Re: [PHP] if... then... else with HTML

2001-04-23 Thread Martin Thoma

Ah, I forgott the {} ;-)

?php
if(strstr($HTTP_USER_AGENT,MSIE)) {
?
centerbYou are using Internet Explorer/b/center
?
} else {
?
centerbYou are not using Internet Explorer/b/center
?
}
?

Martin Thoma schrieb:

 Hello !

 I want to do something like

 if (condition)
 output this html-block
 else
 output that html-block

 Without printig or echoing the html-block out (because the block has a
 lot of  , which I all would have to slash out...)

 How can I do that ?

 Martin

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] if... then... else with HTML

2001-04-23 Thread Taylor, Stewart

?php
if (condition)
{
?
   HTML
?php
{
else
{
?
   HTML
?php
}
?

-Stewart

-Original Message-
From: Martin Thoma [mailto:[EMAIL PROTECTED]]
Sent: 23 April 2001 13:41
To: [EMAIL PROTECTED]
Subject: [PHP] if... then... else with HTML


Hello !

I want to do something like

if (condition)
output this html-block
else
output that html-block


Without printig or echoing the html-block out (because the block has a
lot of  , which I all would have to slash out...)

How can I do that ?

Martin




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] if... then... else with HTML

2001-04-23 Thread Geir Eivind Mork

On Monday 23 April 2001 14:41, Martin Thoma wrote:
if ($word != flat) {

echo OUT
lot of crap with 's and stories about your mom
OUT;

} else { 

echo OUT
do the same
OUT;

}

remember not to have anything before or after OUT (or whatever other text you 
use instead of OUT) or you get prase errors.

Or the html/php switiching way, a fraction slower after my tests :)

?if ($world != flat) {?
html
?}  else {?
html
?]?

-- 
 php developer / CoreTrek AS| I judge a religion as being good or bad 
 Sandnes / Rogaland / Norway| based on whether its adherents become
 web: http://www.moijk.net/ | better people as a result of practicing 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] if... then... else with HTML

2001-04-23 Thread Tyler Longren

?
if (condition) {
?

1st HTML here

?
}
else {
?

2nd HTML here

?
}
?

 -Original Message-
 From: Martin Thoma [mailto:[EMAIL PROTECTED]]
 Sent: Monday, April 23, 2001 7:41 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] if... then... else with HTML
 
 
 Hello !
 
 I want to do something like
 
 if (condition)
 output this html-block
 else
 output that html-block
 
 
 Without printig or echoing the html-block out (because the block has a
 lot of  , which I all would have to slash out...)
 
 How can I do that ?
 
 Martin
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] if... then... else with HTML

2001-04-23 Thread Avetis Avagyan

Something like this:
?php
if (condition)
{
?
   output this html-block
?php
}
else
{
?
output that html-block
?php
}
?

Regards,
Avetis


Martin Thoma wrote:

 Hello !

 I want to do something like

 if (condition)
 output this html-block
 else
 output that html-block

 Without printig or echoing the html-block out (because the block has a
 lot of  , which I all would have to slash out...)

 How can I do that ?

 Martin

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
[EMAIL PROTECTED]
ICT Specialist
UNDP, Armenia



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] if... then... else with HTML

2001-04-23 Thread elias

yes, consider this:

html
body
?  if (isset($name)) { ?
your name is ?=$name?
? } else { ?
h1name is not set!/h1
? } ?
/body
/html

-elias
http://eassoft.cjb.net

Martin Thoma [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello !

 I want to do something like

 if (condition)
 output this html-block
 else
 output that html-block


 Without printig or echoing the html-block out (because the block has a
 lot of  , which I all would have to slash out...)

 How can I do that ?

 Martin




 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] if... then... else with HTML

2001-04-23 Thread Richard Crawford


Alternatively, and this is what I would do because it would be easier to 
maintain should you want to change the content later on, you could use 
includes as per the following:


?php
print(html\nhead\ntitleTry This/title\n/head\nbody\n);
if(condition)
include(html_block_1.html);
else
include(html_block_2.html);
print(/body\n/html);
?

I suppose it would depend on how big your HTML blocks are.

Either way -- using includes or using the method below -- will work, and 
with neither method will you have to escape out your special characters.



 Original Message 

On 4/23/01, 3:59:41 PM, elias [EMAIL PROTECTED] wrote 
regarding Re: [PHP] if... then... else with HTML:


 yes, consider this:

 html
 body
 ?  if (isset($name)) { ?
 your name is ?=$name?
 ? } else { ?
 h1name is not set!/h1
 ? } ?
 /body
 /html

 -elias
 http://eassoft.cjb.net

 Martin Thoma [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hello !
 
  I want to do something like
 
  if (condition)
  output this html-block
  else
  output that html-block
 
 
  Without printig or echoing the html-block out (because the block has a
  lot of  , which I all would have to slash out...)
 
  How can I do that ?
 
  Martin
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] BUG - Someone else please verify B4 I file

2001-04-05 Thread Krznaric Michael

O.k. I understand that, now why would HTTP_POST_VARS be set if no data is
posted?  Is this desired operation?

Mike

-Original Message-
From: Jeff Carnahan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 04, 2001 2:18 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] BUG - Someone else please verify B4 I file


In article 81A3043681E6824EBE672F7421C30E7E2A19A7
@SRVTORONTO.RAND.COM, [EMAIL PROTECTED] says...
}if (isset ($HTTP_POST_VARS)){
}   echo "Http Post Vars Set";

Remember, just because a variable is "set", it doesn't imply that the 
variable has any data stored in it. In this case, while the 
HTTP_POST_VARS array may be set, it does not contain any elements. 
(It's size is zero.)

Hence, it's not included in phpinfo().

--
Jeff Carnahan - [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] BUG - Someone else please verify B4 I file

2001-04-05 Thread Plutarck

Sure. It's an "environment variable", so it should always be set, even if it
is empty.

It's just a matter that all variables are declared, THEN their values are
assigned.

That's how C works, and that's what PHP is built in, so that's the behavior.
It makes it more standard with other applications, without loosing any real
functionality.

So it's annoying at times, but with just a switch-aroo of the functions you
are using, you can do the same stuff.


--
Plutarck
Should be working on something...
...but forgot what it was.


"Krznaric Michael" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 O.k. I understand that, now why would HTTP_POST_VARS be set if no data is
 posted?  Is this desired operation?

 Mike

 -Original Message-
 From: Jeff Carnahan [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, April 04, 2001 2:18 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] BUG - Someone else please verify B4 I file


 In article 81A3043681E6824EBE672F7421C30E7E2A19A7
 @SRVTORONTO.RAND.COM, [EMAIL PROTECTED] says...
 }if (isset ($HTTP_POST_VARS)){
 } echo "Http Post Vars Set";

 Remember, just because a variable is "set", it doesn't imply that the
 variable has any data stored in it. In this case, while the
 HTTP_POST_VARS array may be set, it does not contain any elements.
 (It's size is zero.)

 Hence, it's not included in phpinfo().

 --
 Jeff Carnahan - [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] BUG - Someone else please verify B4 I file

2001-04-04 Thread Data Driven Design

I've noticed that and had to rewrite several scripts when hosts upgraded
from PHP3 to PHP4. $HTTP_POST_VARS is considered set even when it is empty.

Data Driven Design
P.O. Box 1084
Holly Hill, FL 32125-1084

http://www.datadrivendesign.com
http://www.rossidesigns.net
- Original Message -
From: Krznaric Michael [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 04, 2001 11:02 AM
Subject: [PHP] BUG - Someone else please verify B4 I file


 There seems to be a bug in php 4.0.4pl1, would someone please verify
 this script below.  If you paste this script into a file called bug.php
and
 you just call it you will see "Http post Vars Set".  However you will not
 find that variable  it in the output of PHPINFO.  I tried this under
 php4.0.2 and the behavior is as expected "Http Post Vars Not Set".

 Can anyone confirm or disprove this?

 Mike

 bug.php
 ?
 if (isset ($HTTP_POST_VARS)){
 echo "Http Post Vars Set";
 }
 else {
 echo "Http Post Vars Not Set";
 }
 phpinfo();
 ?

 My environment:
 PHP-4.0.4pl1 DSO
 Solaris 8
 Apache 1.3.14

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] BUG - Someone else please verify B4 I file

2001-04-04 Thread Jeff Carnahan

In article 81A3043681E6824EBE672F7421C30E7E2A19A7
@SRVTORONTO.RAND.COM, [EMAIL PROTECTED] says...
}if (isset ($HTTP_POST_VARS)){
}   echo "Http Post Vars Set";

Remember, just because a variable is "set", it doesn't imply that the 
variable has any data stored in it. In this case, while the 
HTTP_POST_VARS array may be set, it does not contain any elements. 
(It's size is zero.)

Hence, it's not included in phpinfo().

--
Jeff Carnahan - [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] BUG - Someone else please verify B4 I file

2001-04-04 Thread Andrew Rush

on 4/4/01 5:14 PM, Data Driven Design at [EMAIL PROTECTED] wrote:

 I've noticed that and had to rewrite several scripts when hosts upgraded
 from PHP3 to PHP4. $HTTP_POST_VARS is considered set even when it is empty.

i have also noticed this. we run 4.0.3pl1 here.


have a great day
andy

-- 
***
Andrew Rush :: Lead Systems Developer :: MaineToday.com
***

"A friend of the devil is a friend of mine" - R. Hunter





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] BUG - Someone else please verify B4 I file

2001-04-04 Thread Steve Werby

"Data Driven Design" [EMAIL PROTECTED] wrote:
 I've noticed that and had to rewrite several scripts when hosts upgraded
 from PHP3 to PHP4. $HTTP_POST_VARS is considered set even when it is
empty.

For those that can't guess the solution to this problem I suspect this will
do the trick:

! empty()

instead of:

isset()

Or Jeff (Data Driven Design), did you use a different technique?

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Simple If-else statement

2001-03-27 Thread Johnson, Kirk

This code is checking if $fname and $lname are equal to a single blank
character. Is this what you want? My guess is you really want

if(($fname == "") || ($lname == ""))

Another way to write this is

if( (!$fname) || (!$lname) )

Kirk


 -Original Message-
 From: Louis Brooks [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, March 27, 2001 11:34 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Simple If-else statement
 
 
 Hi:
 
 I am trying to set up a simple script that will verify that 
 all the blanks 
 in a form have been filled out and then submit that to mySQL. 
 If the form 
 has not been completely filled out I want it to redirect them 
 back to the 
 original form. I know that the mySQL part of the script 
 works, but I am 
 unable to get the part of the script that checks the form 
 input to see if 
 everything was filled out to work. It seems to bypass this 
 part of the 
 script and enter the info into mySQL . Here is what I have so far:
 
 
 If (($fname == " ") || ($lname == " "))
  {
  header("Location: 
http://callook.org/member_joinform.html");
}else{
 $db = mysql_connect("localhost", "name", "password");
 mysql_select_db("dBase",$db);
 $sql = "INSERT INTO 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Simple If-else statement

2001-03-27 Thread Johannes Janson

Hi,

if ($name == " ") {  checks for a space in $name.
"empty" is either if (§name == "") without a free space
between "" or you could do it with empty($mane)
if (empty($name)) is true if it is empty (who would
have thought this?)

Johannes

"Louis Brooks" [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi:

 I am trying to set up a simple script that will verify that all the blanks
 in a form have been filled out and then submit that to mySQL. If the form
 has not been completely filled out I want it to redirect them back to the
 original form. I know that the mySQL part of the script works, but I am
 unable to get the part of the script that checks the form input to see if
 everything was filled out to work. It seems to bypass this part of the
 script and enter the info into mySQL . Here is what I have so far:


 If (($fname == " ") || ($lname == " "))
  {
  header("Location:
http://callook.org/member_joinform.html");
 }else{
  $db = mysql_connect("localhost", "name", "password");
  mysql_select_db("dBase",$db);
  $sql = "INSERT INTO
 members
 (fname,lname,address,city,state,zip,country,email,username,password)
 VALUES

('$fname','$lname','$address','$city','$state','$zip','$country','$email','$
user
 name','$password')";
  $result = mysql_query($sql);
 }

 I hope the formatting comes out right. I am sure it is something simple I
 have missed but I have tried the script several different ways and nothing
 seems to work. Thank you for any help.

 Sincerely,

 Louis Brooks

 BTW: Is there a faq for this list before I go asking anymore questions?




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Simple If-else statement

2001-03-27 Thread Sterling

H-

Another solution might be to use javascript to check the fields before
the page is even submitted to make sure they put "something" in the
first and last name fields. 

Unfortunately I'm not a javascript person but I've seen it done so much
I'm sure you could find examples on the web or via a web search engine. 

As far as your code; I concure with the other posters replies: "" is
empty, " " is a space. I've made the same mistake. Also did the if
($name = "") { } Screwed me up for a bit until I remembered == is
comparison. 8^) Oh well if you don't use it you lose it. 

Take it easy. 
-Sterling


Louis Brooks wrote:
 
 Hi:
 
 I am trying to set up a simple script that will verify that all the blanks
 in a form have been filled out and then submit that to mySQL. If the form
 has not been completely filled out I want it to redirect them back to the
 original form. I know that the mySQL part of the script works, but I am
 unable to get the part of the script that checks the form input to see if
 everything was filled out to work. It seems to bypass this part of the
 script and enter the info into mySQL . Here is what I have so far:
 
 If (($fname == " ") || ($lname == " "))
  {
  header("Location: http://callook.org/member_joinform.html");
 }else{
  $db = mysql_connect("localhost", "name", "password");
  mysql_select_db("dBase",$db);
  $sql = "INSERT INTO
 members
 (fname,lname,address,city,state,zip,country,email,username,password)
 VALUES
 ('$fname','$lname','$address','$city','$state','$zip','$country','$email','$user
 name','$password')";
  $result = mysql_query($sql);
 }
 
 I hope the formatting comes out right. I am sure it is something simple I
 have missed but I have tried the script several different ways and nothing
 seems to work. Thank you for any help.
 
 Sincerely,
 
 Louis Brooks
 
 BTW: Is there a faq for this list before I go asking anymore questions?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Simple If-else statement

2001-03-27 Thread Louis Brooks

Thanks for everyone's response. I am still not able to get the

if(($fname="")) {

statement to work even with the suggestions everyone made so I am beginning 
to wonder if it is a problem with the server. (It is php3 on an Apache 
server. ) Any other suggestions would be greatly appreciated.

Thanks again,

Louis Brooks



At 02:29 PM 3/27/01 -0500, you wrote:
H-

Another solution might be to use javascript to check the fields before
the page is even submitted to make sure they put "something" in the
first and last name fields.

Unfortunately I'm not a javascript person but I've seen it done so much
I'm sure you could find examples on the web or via a web search engine.

As far as your code; I concure with the other posters replies: "" is
empty, " " is a space. I've made the same mistake. Also did the if
($name = "") { } Screwed me up for a bit until I remembered == is
comparison. 8^) Oh well if you don't use it you lose it.

Take it easy.
-Sterling


Louis Brooks wrote:
 
  Hi:
 
  I am trying to set up a simple script that will verify that all the blanks
  in a form have been filled out and then submit that to mySQL. If the form
  has not been completely filled out I want it to redirect them back to the
  original form. I know that the mySQL part of the script works, but I am
  unable to get the part of the script that checks the form input to see if
  everything was filled out to work. It seems to bypass this part of the
  script and enter the info into mySQL . Here is what I have so far:
 
  If (($fname == " ") || ($lname == " "))
   {
   header("Location: 
 http://callook.org/member_joinform.html");
  }else{
   $db = mysql_connect("localhost", "name", "password");
   mysql_select_db("dBase",$db);
   $sql = "INSERT INTO
  members
  (fname,lname,address,city,state,zip,country,email,username,password)
  VALUES
  
 ('$fname','$lname','$address','$city','$state','$zip','$country','$email','$user
  name','$password')";
   $result = mysql_query($sql);
  }
 
  I hope the formatting comes out right. I am sure it is something simple I
  have missed but I have tried the script several different ways and nothing
  seems to work. Thank you for any help.
 
  Sincerely,
 
  Louis Brooks
 
  BTW: Is there a faq for this list before I go asking anymore questions?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Simple If-else statement

2001-03-27 Thread Sterling

H-

Really, that's strange. 

Try printing out your variables and seeing what is actually being
passed. 

print "FNAME:$fname:\n";

With the : : colons surrounding your variable you can see what if
anything is actually in $fname. 

Also it might have been a typo on your part but be sure to check for
single = and double == when using your if statements. 

For debugging purposes do simple stuff first. 

if ($fname == "") { 
print "NOTHING HERE\n";
//header("Location: http://callook.org/member_joinform.html");
} else {
print "Got Something: FNAME:$fname:\n";

if (1 == 2) {
 $db = mysql_connect("localhost", "name", "password");
 mysql_select_db("dBase",$db);
 $sql = "INSERT INTO 
members 
(fname,lname,address,city,state,zip,country,email,username,password) 
VALUES 

('$fname','$lname','$address','$city','$state','$zip','$country','$email','$user 
name','$password')";
$result = mysql_query($sql);
} # end if block commentor for multipe line comments. It's cleaner. 8^)

} end if-else check.

Hope this is helpful. 
-Sterling


Louis Brooks wrote:
 
 Thanks for everyone's response. I am still not able to get the
 
 if(($fname="")) {
 
 statement to work even with the suggestions everyone made so I am beginning
 to wonder if it is a problem with the server. (It is php3 on an Apache
 server. ) Any other suggestions would be greatly appreciated.
 
 Thanks again,
 
 Louis Brooks
 
 At 02:29 PM 3/27/01 -0500, you wrote:
 H-
 
 Another solution might be to use javascript to check the fields before
 the page is even submitted to make sure they put "something" in the
 first and last name fields.
 
 Unfortunately I'm not a javascript person but I've seen it done so much
 I'm sure you could find examples on the web or via a web search engine.
 
 As far as your code; I concure with the other posters replies: "" is
 empty, " " is a space. I've made the same mistake. Also did the if
 ($name = "") { } Screwed me up for a bit until I remembered == is
 comparison. 8^) Oh well if you don't use it you lose it.
 
 Take it easy.
 -Sterling
 
 
 Louis Brooks wrote:
  
   Hi:
  
   I am trying to set up a simple script that will verify that all the blanks
   in a form have been filled out and then submit that to mySQL. If the form
   has not been completely filled out I want it to redirect them back to the
   original form. I know that the mySQL part of the script works, but I am
   unable to get the part of the script that checks the form input to see if
   everything was filled out to work. It seems to bypass this part of the
   script and enter the info into mySQL . Here is what I have so far:
  
   If (($fname == " ") || ($lname == " "))
{
header("Location:
  http://callook.org/member_joinform.html");
   }else{
$db = mysql_connect("localhost", "name", "password");
mysql_select_db("dBase",$db);
$sql = "INSERT INTO
   members
   (fname,lname,address,city,state,zip,country,email,username,password)
   VALUES
  
  ('$fname','$lname','$address','$city','$state','$zip','$country','$email','$user
   name','$password')";
$result = mysql_query($sql);
   }
  
   I hope the formatting comes out right. I am sure it is something simple I
   have missed but I have tried the script several different ways and nothing
   seems to work. Thank you for any help.
  
   Sincerely,
  
   Louis Brooks
  
   BTW: Is there a faq for this list before I go asking anymore questions?
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Simple If-else statement

2001-03-27 Thread Johannes Janson

Hi Louis,

you cuold try it with if (empty($fname)) { redirect...
just check again that your form is ok.

Johannes

"Louis Brooks" [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Thanks for everyone's response. I am still not able to get the

 if(($fname="")) {

 statement to work even with the suggestions everyone made so I am
beginning
 to wonder if it is a problem with the server. (It is php3 on an Apache
 server. ) Any other suggestions would be greatly appreciated.

 Thanks again,

 Louis Brooks





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Simple If-else statement - Fixed

2001-03-27 Thread Louis Brooks

Thanks for all the help. I finally got it to work. I ended up using a bunch 
of if ($lname=="") { statements instead of if (($lname=="") || 
($fname=="")) { and that seems to be working. I still can't get the 
header() statement to work. So I just cheated and put in some text telling 
the user to hit the back button and fill out the rest of the information on 
the form.

Louis


At 02:29 PM 3/27/01 -0500, you wrote:
H-

Another solution might be to use javascript to check the fields before
the page is even submitted to make sure they put "something" in the
first and last name fields.

Unfortunately I'm not a javascript person but I've seen it done so much
I'm sure you could find examples on the web or via a web search engine.

As far as your code; I concure with the other posters replies: "" is
empty, " " is a space. I've made the same mistake. Also did the if
($name = "") { } Screwed me up for a bit until I remembered == is
comparison. 8^) Oh well if you don't use it you lose it.

Take it easy.
-Sterling


Louis Brooks wrote:
 
  Hi:
 
  I am trying to set up a simple script that will verify that all the blanks
  in a form have been filled out and then submit that to mySQL. If the form
  has not been completely filled out I want it to redirect them back to the
  original form. I know that the mySQL part of the script works, but I am
  unable to get the part of the script that checks the form input to see if
  everything was filled out to work. It seems to bypass this part of the
  script and enter the info into mySQL . Here is what I have so far:
 
  If (($fname == " ") || ($lname == " "))
   {
   header("Location: 
 http://callook.org/member_joinform.html");
  }else{
   $db = mysql_connect("localhost", "name", "password");
   mysql_select_db("dBase",$db);
   $sql = "INSERT INTO
  members
  (fname,lname,address,city,state,zip,country,email,username,password)
  VALUES
  
 ('$fname','$lname','$address','$city','$state','$zip','$country','$email','$user
  name','$password')";
   $result = mysql_query($sql);
  }
 
  I hope the formatting comes out right. I am sure it is something simple I
  have missed but I have tried the script several different ways and nothing
  seems to work. Thank you for any help.
 
  Sincerely,
 
  Louis Brooks
 
  BTW: Is there a faq for this list before I go asking anymore questions?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



Re: [PHP] Simple If-else statement - Fixed

2001-03-27 Thread Johannes Janson

Hi,

for the haeder just make sure that there is NO output
whatsoever before the header-call. even if line 1 of your
script is empty before the ?php-tag the header doesn't work.


"Louis Brooks" [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Thanks for all the help. I finally got it to work. I ended up using a
bunch
 of if ($lname=="") { statements instead of if (($lname=="") ||
 ($fname=="")) { and that seems to be working. I still can't get the
 header() statement to work. So I just cheated and put in some text telling
 the user to hit the back button and fill out the rest of the information
on
 the form.

 Louis






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]