Re: [PHP] Anyone else have trouble with Apple Mail threading this list?

2009-01-02 Thread phphelp -- kbk


On Dec 31, 2008, at 5:55 PM, Brian Dunning wrote:

... When I hit Reply or Reply All in Mail, it wants to
reply directly to the poster, and only CC's the list...


That is just the way the list works. (If you look at threads, you  
will see a fairly-constant stream of reminders to reply all to stay  
on the public listserv).


Other lists to which I subscribe don't behave like this. I can't  
understand why this one does. Even if people remember to reply all  
the recipient gets 2 copies of the reply. (If only the list admin  
knew of some programmer who could alter this g)


All of this is tolerable for the great information exchanged, but it  
*is* annoying.


Ken

(Ironically, I initially forgot to reply all on this one, so I had  
to re-do it.)


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



[PHP] Anyone else have trouble with Apple Mail threading this list?

2008-12-31 Thread Brian Dunning
I use Apple Mail, and subscribe to many lists but PHP-General is the  
only one I have this problem with. People tell me that my replies are  
not properly threaded to the original post. When I hit Reply or Reply  
All in Mail, it wants to reply directly to the poster, and only CC's  
the list. So I drag the CC address up to the To field and delete the  
poster's address. Seems like the best I can do, but it creates this  
problem people have reported. Do I just totally suck, or is there a  
more reasonable explanation?


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



Re: [PHP] Anyone else doing PHP on Symbian?

2008-02-06 Thread Peter Ford
Paul Scott wrote:
 On Tue, 2008-02-05 at 13:29 -0500, Daniel Brown wrote:
   Still debating what
 device I'll get next, but I want to use it as a mobile server myself.
 I had been working on a bound-for-trash PDA doing the same a while
 back, but with what we'll refer to as limited results.
 
 I think that the key here is 
 
 1. A decent ARM processor and a PHP build for ARM specifically (new
 project??)
 
 2. Enough RAM to be useful - at least figure out how to use a SD card or
 something as a RAMDisk and use like a 2GB card?
 
 3. Getting an entire LAMP stack on there as a package - no use messing
 with things - otherwise people won't use it.
 
 Just think of the possibilities though... I do a lot in the eLearning
 sphere in PHP, and this type of thing could be a mobile eLearning server
 for rural schools in Africa that is actually affordable! Students could
 connect to it via thin clients or mobile phones and get an education all
 in one.
 

To be honest Paul, I think you'd find that an EeePC would be cheaper than a
sufficiently well-specced PDA, especially given the time and effort required for
the key points you describe. An EeePC already runs Linux, with a decent
processor, reasonable disk space and good connectivity options, so a LAMP
stack ought to be easy.

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



[PHP] Anyone else doing PHP on Symbian?

2008-02-05 Thread George Pitcher
Hi,

I've recently installed PAMP (PHP, Apache, MySQL  Python) on my Nokia N95.
I can do my development in Dreamweaver and move across to the phone and it
all works.

I have some questions, but won't bother asking if there's no-one else here
doing it.

Cheers

George, in a very wet Edinburgh

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



Re: [PHP] Anyone else doing PHP on Symbian?

2008-02-05 Thread Paul Scott

On Tue, 2008-02-05 at 14:44 +, George Pitcher wrote:

 I've recently installed PAMP (PHP, Apache, MySQL  Python) on my Nokia N95.
 I can do my development in Dreamweaver and move across to the phone and it
 all works.
 

Sounds intruiging! Care to share some resources/links as to how to set
up? I have a Sony/Ericsson P990i that I don't mind destroying with
insane hacks, and this sounds like fun!

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] Anyone else doing PHP on Symbian?

2008-02-05 Thread Daniel Brown
On Feb 5, 2008 9:50 AM, Paul Scott [EMAIL PROTECTED] wrote:

 On Tue, 2008-02-05 at 14:44 +, George Pitcher wrote:

  I've recently installed PAMP (PHP, Apache, MySQL  Python) on my Nokia N95.
  I can do my development in Dreamweaver and move across to the phone and it
  all works.
 

 Sounds intruiging! Care to share some resources/links as to how to set
 up? I have a Sony/Ericsson P990i that I don't mind destroying with
 insane hacks, and this sounds like fun!

Indeed, it does, but I don't have a spare to help with anymore.
The most I really did on mine was using it as a client (such as with
the Symbian version of PuTTY:
http://s2putty.sourceforge.net/download.html).  Still debating what
device I'll get next, but I want to use it as a mobile server myself.
I had been working on a bound-for-trash PDA doing the same a while
back, but with what we'll refer to as limited results.

(Read: Total destruction.)

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



Re: [PHP] Anyone else doing PHP on Symbian?

2008-02-05 Thread Cameron Just
More info can be found here... When I get my Nokia N82 I am going to try 
it out.


http://wiki.opensource.nokia.com/projects/PAMP

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



Re: [PHP] Anyone else doing PHP on Symbian?

2008-02-05 Thread Paul Scott

On Tue, 2008-02-05 at 13:29 -0500, Daniel Brown wrote:
   Still debating what
 device I'll get next, but I want to use it as a mobile server myself.
 I had been working on a bound-for-trash PDA doing the same a while
 back, but with what we'll refer to as limited results.

I think that the key here is 

1. A decent ARM processor and a PHP build for ARM specifically (new
project??)

2. Enough RAM to be useful - at least figure out how to use a SD card or
something as a RAMDisk and use like a 2GB card?

3. Getting an entire LAMP stack on there as a package - no use messing
with things - otherwise people won't use it.

Just think of the possibilities though... I do a lot in the eLearning
sphere in PHP, and this type of thing could be a mobile eLearning server
for rural schools in Africa that is actually affordable! Students could
connect to it via thin clients or mobile phones and get an education all
in one.

--Paul



All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] if(), else() problem!

2006-10-09 Thread Rahul S. Johari

Well actually, all 80 fields (not records) that I'm displaying out of the
row (matched by phone number) have to be displayed on the page.
Non-Editable. Just displayed for viewing.

I am certainly using the query to search dbase and display the results. So
technically nothing that I'm doing is causing any problems...

As for the if(), else()... I did figure out a couple of ways to do it... But
I guess the simplest one was the one you  jochem had suggested, which is
pretty much like...

$db = dbase_open(osm.dbf, 0);
if ($db) {
   $record_numbers = dbase_numrecords($db);
$found = false;
for ($i = 1; $i = $record_numbers; $i++) {
   $row = dbase_get_record_with_names($db, $i);
   if ($row['PHONE'] == $thekey) {
   echo ³found²;
$found = $thekey;
  }
   else {
//   echo ³not found²;
// do nothing here
 }
 }

if (!$found) echo not found;
}

Basically used a 'flag'... If phone number was matched (found) in the
dbase... Everything gets displayed and nothing happens in the else() ... But
if phone number was not found, flag is raised, i.e., error message
displayed. 

Working like a charm as far as I can tell.

Thanks!

On 10/6/06 5:21 PM, Richard Lynch [EMAIL PROTECTED] wrote:

 On Fri, October 6, 2006 2:59 pm, Rahul S. Johari wrote:
 I'm not sure if I understand your point then! I have about 80 fields
 in that
 database that are fetched and displayed on the page using this code.
 If
 there's a simpler way to do this, and have it work the if() else()
 error as
 well, I would love to know about it...
 
 Are you displaying 79 records not editable, and ONE that is editable,
 all on one page?
 
 That's an Okay Reason, but you'd probably have happier users if you
 didn't do that...
 
 Give them a link to edit ONE record and let them edit that all by
 itself and then come back to the list when they are done.
 
 Too Much Information is not a good thing.

Rahul S. Johari
Supervisor, Internet  Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

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



[PHP] if(), else() problem!

2006-10-06 Thread Rahul S. Johari
Ave,

code:

$db = dbase_open(osm.dbf, 0);
if ($db) {
  $record_numbers = dbase_numrecords($db);
  for ($i = 1; $i = $record_numbers; $i++) {
 $row = dbase_get_record_with_names($db, $i);
 if ($row['PHONE'] == $thekey) {
echo ³found²;
}
else {
echo ³not found²;
}
}
}

The loop reads each row in the database, and checks whether it matches
$thekey or not. If it does, it prints ³found², if it doesn¹t, it prints ³not
found². But this happens for ³each row² in the database. So if there are 100
records, and the program does find a match, I¹ll get 99 ³not found² printed,
and one ³found² printed.

I can easily put an ³exit;² after my echo in the else(), but then it stops
the loop, and doesn¹t go any further.

What do I have to do to get results if the phone matches, print nothing for
rows where it doesn¹t match, but give one single ³not found² if the phone
number does not exist in the database?

The logic is just failing me at this point.

Rahul S. Johari
Supervisor, Internet  Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com



Re: [PHP] if(), else() problem!

2006-10-06 Thread Jo�o C�ndido de Souza Neto
Usen this:

echo ³not found²;
break;


Rahul S. Johari [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]
Ave,

code:

$db = dbase_open(osm.dbf, 0);
if ($db) {
  $record_numbers = dbase_numrecords($db);
  for ($i = 1; $i = $record_numbers; $i++) {
 $row = dbase_get_record_with_names($db, $i);
 if ($row['PHONE'] == $thekey) {
echo ³found²;
}
else {
echo ³not found²;
break;
}
}
}

The loop reads each row in the database, and checks whether it matches
$thekey or not. If it does, it prints ³found², if it doesn¹t, it prints ³not
found². But this happens for ³each row² in the database. So if there are 100
records, and the program does find a match, I¹ll get 99 ³not found² printed,
and one ³found² printed.

I can easily put an ³exit;² after my echo in the else(), but then it stops
the loop, and doesn¹t go any further.

What do I have to do to get results if the phone matches, print nothing for
rows where it doesn¹t match, but give one single ³not found² if the phone
number does not exist in the database?

The logic is just failing me at this point.

Rahul S. Johari
Supervisor, Internet  Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

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



Re: [PHP] if(), else() problem!

2006-10-06 Thread Jochem Maas
Rahul S. Johari wrote:
 Ave,
 
 code:
 
 $db = dbase_open(osm.dbf, 0);
 if ($db) {
   $record_numbers = dbase_numrecords($db);
   for ($i = 1; $i = $record_numbers; $i++) {
  $row = dbase_get_record_with_names($db, $i);
  if ($row['PHONE'] == $thekey) {
 echo ³found²;
 }
 else {
 echo ³not found²;
 }
 }
 }


$msg = 'cannot open database!';
if ($db = dbase_open(osm.dbf, 0)) {
$msg = 'database contains no records!';
if ($record_numbers = dbase_numrecords($db)) {
$msg = 'number not found';
for ($i = 1; $i = $record_numbers; $row = 
dbase_get_record_with_names($db, $i),$i++)
if ($row['PHONE'] == $thekey) { $msg = 'number found'; break; }
}
}
echo $msg;
// ^^^--- untested

 
 The loop reads each row in the database, and checks whether it matches
 $thekey or not. If it does, it prints ³found², if it doesn¹t, it prints ³not
 found². But this happens for ³each row² in the database. So if there are 100
 records, and the program does find a match, I¹ll get 99 ³not found² printed,
 and one ³found² printed.
 
 I can easily put an ³exit;² after my echo in the else(), but then it stops
 the loop, and doesn¹t go any further.
 
 What do I have to do to get results if the phone matches, print nothing for
 rows where it doesn¹t match, but give one single ³not found² if the phone
 number does not exist in the database?
 
 The logic is just failing me at this point.
 
 Rahul S. Johari
 Supervisor, Internet  Administration
 Informed Marketing Services Inc.
 500 Federal Street, Suite 201
 Troy NY 12180
 
 Tel: (518) 687-6700 x154
 Fax: (518) 687-6799
 Email: [EMAIL PROTECTED]
 http://www.informed-sources.com
 
 

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



Re: [PHP] if(), else() problem!

2006-10-06 Thread Rahul S. Johari

Just tried, isn't working! It's doing the same thing that exit; does.

Both

 else {
echo Not Found;
 break;
 }

And

 else {
echo Not Found;
 exit;
 }

Do the exact same thing. It will print not found (because it checks the
first row, and if the phone number is not in the first row), and basically
exit and not go further with the loop.


On 10/6/06 12:40 PM, João Cândido de Souza Neto
[EMAIL PROTECTED] wrote:

 Usen this:
 
 echo ³not found²;
 break;
 
 
 Rahul S. Johari [EMAIL PROTECTED] escreveu na mensagem
 news:[EMAIL PROTECTED]
 Ave,
 
 code:
 
 $db = dbase_open(osm.dbf, 0);
 if ($db) {
   $record_numbers = dbase_numrecords($db);
   for ($i = 1; $i = $record_numbers; $i++) {
  $row = dbase_get_record_with_names($db, $i);
  if ($row['PHONE'] == $thekey) {
 echo ³found²;
 }
 else {
 echo ³not found²;
 break;
 }
 }
 }
 
 The loop reads each row in the database, and checks whether it matches
 $thekey or not. If it does, it prints ³found², if it doesn¹t, it prints ³not
 found². But this happens for ³each row² in the database. So if there are 100
 records, and the program does find a match, I¹ll get 99 ³not found² printed,
 and one ³found² printed.
 
 I can easily put an ³exit;² after my echo in the else(), but then it stops
 the loop, and doesn¹t go any further.
 
 What do I have to do to get results if the phone matches, print nothing for
 rows where it doesn¹t match, but give one single ³not found² if the phone
 number does not exist in the database?
 
 The logic is just failing me at this point.
 

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



Re: [PHP] if(), else() problem!

2006-10-06 Thread Rahul S. Johari

Works like a charm!! I was trying something out with having a variable go
completely out of the functions  loops and print the not found message,
but I wasn't hitting it. You did!

// ^^^--- now tested ;)


On 10/6/06 1:52 PM, Jochem Maas [EMAIL PROTECTED] wrote:

 $msg = 'cannot open database!';
 if ($db = dbase_open(osm.dbf, 0)) {
 $msg = 'database contains no records!';
 if ($record_numbers = dbase_numrecords($db)) {
 $msg = 'number not found';
 for ($i = 1; $i = $record_numbers; $row =
 dbase_get_record_with_names($db, $i),$i++)
 if ($row['PHONE'] == $thekey) { $msg = 'number found'; break; }
 }
 }
 echo $msg;
 // ^^^--- untested
 

Rahul S. Johari
Supervisor, Internet  Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

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



Re: [PHP] if(), else() problem!

2006-10-06 Thread Børge Holen
Why not check if $thekey is in the $db, then else echo not found?
seems all to much to do so little.

On Friday 06 October 2006 18:35, Rahul S. Johari wrote:
 Ave,

 code:

 $db = dbase_open(osm.dbf, 0);
 if ($db) {
   $record_numbers = dbase_numrecords($db);
   for ($i = 1; $i = $record_numbers; $i++) {
  $row = dbase_get_record_with_names($db, $i);
  if ($row['PHONE'] == $thekey) {
 echo ³found²;
 }
 else {
 echo ³not found²;
 }
 }
 }

 The loop reads each row in the database, and checks whether it matches
 $thekey or not. If it does, it prints ³found², if it doesn¹t, it prints
 ³not found². But this happens for ³each row² in the database. So if there
 are 100 records, and the program does find a match, I¹ll get 99 ³not found²
 printed, and one ³found² printed.

 I can easily put an ³exit;² after my echo in the else(), but then it stops
 the loop, and doesn¹t go any further.

 What do I have to do to get results if the phone matches, print nothing for
 rows where it doesn¹t match, but give one single ³not found² if the phone
 number does not exist in the database?

 The logic is just failing me at this point.

 Rahul S. Johari
 Supervisor, Internet  Administration
 Informed Marketing Services Inc.
 500 Federal Street, Suite 201
 Troy NY 12180

 Tel: (518) 687-6700 x154
 Fax: (518) 687-6799
 Email: [EMAIL PROTECTED]
 http://www.informed-sources.com

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

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



Re: [PHP] if(), else() problem!

2006-10-06 Thread Rahul S. Johari

Well, the actual script doesn't just print found number if the number
exists... It displays all the data from the database of that record, also
gives an interactive form to update the data and more.



On 10/6/06 3:25 PM, Børge Holen [EMAIL PROTECTED] wrote:

 Why not check if $thekey is in the $db, then else echo not found?
 seems all to much to do so little.
 
 On Friday 06 October 2006 18:35, Rahul S. Johari wrote:
 Ave,
 
 code:
 
 $db = dbase_open(osm.dbf, 0);
 if ($db) {
   $record_numbers = dbase_numrecords($db);
   for ($i = 1; $i = $record_numbers; $i++) {
  $row = dbase_get_record_with_names($db, $i);
  if ($row['PHONE'] == $thekey) {
 echo ³found²;
 }
 else {
 echo ³not found²;
 }
 }
 }
 
 The loop reads each row in the database, and checks whether it matches
 $thekey or not. If it does, it prints ³found², if it doesn¹t, it prints
 ³not found². But this happens for ³each row² in the database. So if there
 are 100 records, and the program does find a match, I¹ll get 99 ³not found²
 printed, and one ³found² printed.
 
 I can easily put an ³exit;² after my echo in the else(), but then it stops
 the loop, and doesn¹t go any further.
 
 What do I have to do to get results if the phone matches, print nothing for
 rows where it doesn¹t match, but give one single ³not found² if the phone
 number does not exist in the database?
 
 The logic is just failing me at this point.
 
 Rahul S. Johari
 Supervisor, Internet  Administration
 Informed Marketing Services Inc.
 500 Federal Street, Suite 201
 Troy NY 12180
 
 Tel: (518) 687-6700 x154
 Fax: (518) 687-6799
 Email: [EMAIL PROTECTED]
 http://www.informed-sources.com

Rahul S. Johari
Supervisor, Internet  Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

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



Re: [PHP] if(), else() problem!

2006-10-06 Thread Børge Holen
On Friday 06 October 2006 21:45, Rahul S. Johari wrote:
 Well, the actual script doesn't just print found number if the number
 exists... It displays all the data from the database of that record, also
 gives an interactive form to update the data and more.

Yes, and my point is still valid. need only to fetch bits'n bytes where 
$thekey is located, leave the rest be.


 On 10/6/06 3:25 PM, Børge Holen [EMAIL PROTECTED] wrote:
  Why not check if $thekey is in the $db, then else echo not found?
  seems all to much to do so little.
 
  On Friday 06 October 2006 18:35, Rahul S. Johari wrote:
  Ave,
 
  code:
 
  $db = dbase_open(osm.dbf, 0);
  if ($db) {
$record_numbers = dbase_numrecords($db);
for ($i = 1; $i = $record_numbers; $i++) {
   $row = dbase_get_record_with_names($db, $i);
   if ($row['PHONE'] == $thekey) {
  echo ³found²;
  }
  else {
  echo ³not found²;
  }
  }
  }
 
  The loop reads each row in the database, and checks whether it matches
  $thekey or not. If it does, it prints ³found², if it doesn¹t, it prints
  ³not found². But this happens for ³each row² in the database. So if
  there are 100 records, and the program does find a match, I¹ll get 99
  ³not found² printed, and one ³found² printed.
 
  I can easily put an ³exit;² after my echo in the else(), but then it
  stops the loop, and doesn¹t go any further.
 
  What do I have to do to get results if the phone matches, print nothing
  for rows where it doesn¹t match, but give one single ³not found² if the
  phone number does not exist in the database?
 
  The logic is just failing me at this point.
 
  Rahul S. Johari
  Supervisor, Internet  Administration
  Informed Marketing Services Inc.
  500 Federal Street, Suite 201
  Troy NY 12180
 
  Tel: (518) 687-6700 x154
  Fax: (518) 687-6799
  Email: [EMAIL PROTECTED]
  http://www.informed-sources.com

 Rahul S. Johari
 Supervisor, Internet  Administration
 Informed Marketing Services Inc.
 500 Federal Street, Suite 201
 Troy NY 12180

 Tel: (518) 687-6700 x154
 Fax: (518) 687-6799
 Email: [EMAIL PROTECTED]
 http://www.informed-sources.com

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

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



Re: [PHP] if(), else() problem!

2006-10-06 Thread Rahul S. Johari

I'm not sure if I understand your point then! I have about 80 fields in that
database that are fetched and displayed on the page using this code. If
there's a simpler way to do this, and have it work the if() else() error as
well, I would love to know about it...


On 10/6/06 3:47 PM, Børge Holen [EMAIL PROTECTED] wrote:

 On Friday 06 October 2006 21:45, Rahul S. Johari wrote:
 Well, the actual script doesn't just print found number if the number
 exists... It displays all the data from the database of that record, also
 gives an interactive form to update the data and more.
 
 Yes, and my point is still valid. need only to fetch bits'n bytes where
 $thekey is located, leave the rest be.
 
 
 On 10/6/06 3:25 PM, Børge Holen [EMAIL PROTECTED] wrote:
 Why not check if $thekey is in the $db, then else echo not found?
 seems all to much to do so little.
 
 On Friday 06 October 2006 18:35, Rahul S. Johari wrote:
 Ave,
 
 code:
 
 $db = dbase_open(osm.dbf, 0);
 if ($db) {
   $record_numbers = dbase_numrecords($db);
   for ($i = 1; $i = $record_numbers; $i++) {
  $row = dbase_get_record_with_names($db, $i);
  if ($row['PHONE'] == $thekey) {
 echo ³found²;
 }
 else {
 echo ³not found²;
 }
 }
 }
 
 The loop reads each row in the database, and checks whether it matches
 $thekey or not. If it does, it prints ³found², if it doesn¹t, it prints
 ³not found². But this happens for ³each row² in the database. So if
 there are 100 records, and the program does find a match, I¹ll get 99
 ³not found² printed, and one ³found² printed.
 
 I can easily put an ³exit;² after my echo in the else(), but then it
 stops the loop, and doesn¹t go any further.
 
 What do I have to do to get results if the phone matches, print nothing
 for rows where it doesn¹t match, but give one single ³not found² if the
 phone number does not exist in the database?
 
 The logic is just failing me at this point.
 
 Rahul S. Johari
 Supervisor, Internet  Administration
 Informed Marketing Services Inc.
 500 Federal Street, Suite 201
 Troy NY 12180
 
 Tel: (518) 687-6700 x154
 Fax: (518) 687-6799
 Email: [EMAIL PROTECTED]
 http://www.informed-sources.com
 
 Rahul S. Johari
 Supervisor, Internet  Administration
 Informed Marketing Services Inc.
 500 Federal Street, Suite 201
 Troy NY 12180
 
 Tel: (518) 687-6700 x154
 Fax: (518) 687-6799
 Email: [EMAIL PROTECTED]
 http://www.informed-sources.com

Rahul S. Johari
Supervisor, Internet  Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

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



Re: [PHP] if(), else() problem!

2006-10-06 Thread Richard Lynch
On Fri, October 6, 2006 11:35 am, Rahul S. Johari wrote:
 $db = dbase_open(osm.dbf, 0);
 if ($db) {
   $record_numbers = dbase_numrecords($db);
$found = false;
   for ($i = 1; $i = $record_numbers; $i++) {
  $row = dbase_get_record_with_names($db, $i);
  if ($row['PHONE'] == $thekey) {
 echo ³found²;
$found = $thekey;
 }
 else {
//   echo ³not found²;
// do nothing here
 }
 }

if (!$found) echo not found;

 }


dbase *does* have some kind of way to just search with a query or
something, right?...  Use it if it does.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] if(), else() problem!

2006-10-06 Thread Richard Lynch
On Fri, October 6, 2006 2:45 pm, Rahul S. Johari wrote:
 Well, the actual script doesn't just print found number if the
 number
 exists... It displays all the data from the database of that record,
 also
 gives an interactive form to update the data and more.

None of which is a Good Reason to replace the dbase search with your
own PHP loop...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] if(), else() problem!

2006-10-06 Thread Richard Lynch
On Fri, October 6, 2006 2:59 pm, Rahul S. Johari wrote:
 I'm not sure if I understand your point then! I have about 80 fields
 in that
 database that are fetched and displayed on the page using this code.
 If
 there's a simpler way to do this, and have it work the if() else()
 error as
 well, I would love to know about it...

Are you displaying 79 records not editable, and ONE that is editable,
all on one page?

That's an Okay Reason, but you'd probably have happier users if you
didn't do that...

Give them a link to edit ONE record and let them edit that all by
itself and then come back to the list when they are done.

Too Much Information is not a good thing.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] if(), else() problem!

2006-10-06 Thread Børge Holen
On Friday 06 October 2006 21:59, Rahul S. Johari wrote:
 I'm not sure if I understand your point then! I have about 80 fields in
 that database that are fetched and displayed on the page using this code.
 If there's a simpler way to do this, and have it work the if() else() error
 as well, I would love to know about it...

Dunno but this:

 ... for ($i = 1; $i = $record_numbers; $i++) { $row = 
dbase_get_record_with_names($db, $i);
 if ($row['PHONE'] ...

looks like my c++ source of kde, quite heavy. Yes I'm sure a lot of ppl on 
this list like it like that, but from what I've learned is that projects 
needs modifications from time to time. and a lot of jibberish like this 
probably would have caused me a great deal of stress under a time table.

I would go on a problem like this with this solution

select whatever_tables_needed from $db where info=$hastomatch
whilethis and that {
show it all in a fancy form;
}else{
do_woop_that_thing and show something else;
}

That would only leave me with the $thekey  info.

OR, reflecting on yer problem; would there be a possability that $thekey is 
not at all valid?

Whereas you would need to add an error if the select renders no hit


 On 10/6/06 3:47 PM, Børge Holen [EMAIL PROTECTED] wrote:
  On Friday 06 October 2006 21:45, Rahul S. Johari wrote:
  Well, the actual script doesn't just print found number if the number
  exists... It displays all the data from the database of that record,
  also gives an interactive form to update the data and more.
 
  Yes, and my point is still valid. need only to fetch bits'n bytes where
  $thekey is located, leave the rest be.
 
  On 10/6/06 3:25 PM, Børge Holen [EMAIL PROTECTED] wrote:
  Why not check if $thekey is in the $db, then else echo not found?
  seems all to much to do so little.
 
  On Friday 06 October 2006 18:35, Rahul S. Johari wrote:
  Ave,
 
  code:
 
  $db = dbase_open(osm.dbf, 0);
  if ($db) {
$record_numbers = dbase_numrecords($db);
for ($i = 1; $i = $record_numbers; $i++) {
   $row = dbase_get_record_with_names($db, $i);
   if ($row['PHONE'] == $thekey) {
  echo ³found²;
  }
  else {
  echo ³not found²;
  }
  }
  }
 
  The loop reads each row in the database, and checks whether it matches
  $thekey or not. If it does, it prints ³found², if it doesn¹t, it
  prints ³not found². But this happens for ³each row² in the database.
  So if there are 100 records, and the program does find a match, I¹ll
  get 99 ³not found² printed, and one ³found² printed.
 
  I can easily put an ³exit;² after my echo in the else(), but then it
  stops the loop, and doesn¹t go any further.
 
  What do I have to do to get results if the phone matches, print
  nothing for rows where it doesn¹t match, but give one single ³not
  found² if the phone number does not exist in the database?
 
  The logic is just failing me at this point.
 
  Rahul S. Johari
  Supervisor, Internet  Administration
  Informed Marketing Services Inc.
  500 Federal Street, Suite 201
  Troy NY 12180
 
  Tel: (518) 687-6700 x154
  Fax: (518) 687-6799
  Email: [EMAIL PROTECTED]
  http://www.informed-sources.com
 
  Rahul S. Johari
  Supervisor, Internet  Administration
  Informed Marketing Services Inc.
  500 Federal Street, Suite 201
  Troy NY 12180
 
  Tel: (518) 687-6700 x154
  Fax: (518) 687-6799
  Email: [EMAIL PROTECTED]
  http://www.informed-sources.com

 Rahul S. Johari
 Supervisor, Internet  Administration
 Informed Marketing Services Inc.
 500 Federal Street, Suite 201
 Troy NY 12180

 Tel: (518) 687-6700 x154
 Fax: (518) 687-6799
 Email: [EMAIL PROTECTED]
 http://www.informed-sources.com

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

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



[PHP] php: else if problem

2005-03-22 Thread Leonidas Savvides
to: 'php-general@lists.php.net'
 
from: Leonidas Savvides
 
 
Please see my problem below in PHP code :
  _  

?php
  echo $month, $day, $year, $month2, $day2, $year2;// these are
ok-normal values from web form 
  if ( ! @checkdate($month,$day,$year) ) {
   echo this operate till here;  // include_once
(normaldays.php);   @  //   wrongpickupdate.htm
  } else if ( ! @checkdate($month2,$day2,$year2) ) {
   include_once (wrongdropoffdate.htm); 
  } else if ( $tsp  $tsnow ) {   //  $tsp=time stamp
pickup date
   include_once (wrongpickupdate.htm); // include_once
(normaldays.php); //   wrongpickupdate.htm
  } else if ( $tsp = $tsd ) {   //  $tsd=time stamp drop
off date
   include_once (wrongpickupdate.htm); 
  } else if ( $days = 60 ) {   //  $days var come from
$tsd  $tsp
   include_once (manydays.htm);
  } else if ( $days = 2 ) {
   include_once (fewdays.htm);
  } else {
   include_once (normaldays.php); 
  }
 
?
  _  

problem
 
1.  executes first statement what ever vars are 
2.  if no ! to  first statement , executes second statement 
3.  if no ! to  first  second  statement, executes first
include_once() statement meaning :  
} else if ( $tsp  $tsnow ) {
include_once (wrongpickupdate.htm); 
}
whatever values of  $tsp  $tsnow are .
 
well WHERE THE PROBLEM IS ?
*mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] 
*
http://us.f610.mail.yahoo.com/ym/[EMAIL PROTECTED]
[EMAIL PROTECTED]
*   Leonidas Savvides
 


Re: [PHP] php: else if problem

2005-03-22 Thread Franklin van de Meent
In PHP you should write it as } elseif {, so there's no space
between else and if.

Read http://php.net/elseif for more details



On Tue, 22 Mar 2005 22:48:00 +0200, Leonidas Savvides
[EMAIL PROTECTED] wrote:
 to: 'php-general@lists.php.net'
 
 from: Leonidas Savvides
 
 Please see my problem below in PHP code :
   _
 
 ?php
   echo $month, $day, $year, $month2, $day2, $year2;// these are
 ok-normal values from web form
   if ( ! @checkdate($month,$day,$year) ) {
echo this operate till here;  // include_once
 (normaldays.php);   @  //   wrongpickupdate.htm
   } else if ( ! @checkdate($month2,$day2,$year2) ) {
include_once (wrongdropoffdate.htm);
   } else if ( $tsp  $tsnow ) {   //  $tsp=time stamp
 pickup date
include_once (wrongpickupdate.htm); // include_once
 (normaldays.php); //   wrongpickupdate.htm
   } else if ( $tsp = $tsd ) {   //  $tsd=time stamp drop
 off date
include_once (wrongpickupdate.htm);
   } else if ( $days = 60 ) {   //  $days var come from
 $tsd  $tsp
include_once (manydays.htm);
   } else if ( $days = 2 ) {
include_once (fewdays.htm);
   } else {
include_once (normaldays.php);
   }
 
 ?
   _
 
 problem
 
 1.  executes first statement what ever vars are
 2.  if no ! to  first statement , executes second statement
 3.  if no ! to  first  second  statement, executes first
 include_once() statement meaning :
 } else if ( $tsp  $tsnow ) {
 include_once (wrongpickupdate.htm);
 }
 whatever values of  $tsp  $tsnow are .
 
 well WHERE THE PROBLEM IS ?
 *mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
 *
 http://us.f610.mail.yahoo.com/ym/[EMAIL PROTECTED]
 [EMAIL PROTECTED]
 *   Leonidas Savvides
 


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



Re: [PHP] php: else if problem

2005-03-22 Thread M. Sokolewicz
read the manual, you can use both (else if and elseif).
The script does exactly what you tell it to. The flaw(s) is(/are) in 
your logic. Second of all, might I please advise you to have a good look 
at your code, and at least *try* to clean it up a bit? I'm sure you 
didn't mean it like this, but your code is wordwrapped in such a weird 
way that it's hard to distinguish what is actual executable code, and 
what your comments are supposed to be

- tul
Franklin van de Meent wrote:
In PHP you should write it as } elseif {, so there's no space
between else and if.
Read http://php.net/elseif for more details

On Tue, 22 Mar 2005 22:48:00 +0200, Leonidas Savvides
[EMAIL PROTECTED] wrote:
to: 'php-general@lists.php.net'
from: Leonidas Savvides
Please see my problem below in PHP code :
 _
?php
 echo $month, $day, $year, $month2, $day2, $year2;// these are
ok-normal values from web form
 if ( ! @checkdate($month,$day,$year) ) {
  echo this operate till here;  // include_once
(normaldays.php);   @  //   wrongpickupdate.htm
 } else if ( ! @checkdate($month2,$day2,$year2) ) {
  include_once (wrongdropoffdate.htm);
 } else if ( $tsp  $tsnow ) {   //  $tsp=time stamp
pickup date
  include_once (wrongpickupdate.htm); // include_once
(normaldays.php); //   wrongpickupdate.htm
 } else if ( $tsp = $tsd ) {   //  $tsd=time stamp drop
off date
  include_once (wrongpickupdate.htm);
 } else if ( $days = 60 ) {   //  $days var come from
$tsd  $tsp
  include_once (manydays.htm);
 } else if ( $days = 2 ) {
  include_once (fewdays.htm);
 } else {
  include_once (normaldays.php);
 }
?
 _
problem
1.  executes first statement what ever vars are
2.  if no ! to  first statement , executes second statement
3.  if no ! to  first  second  statement, executes first
include_once() statement meaning :
} else if ( $tsp  $tsnow ) {
include_once (wrongpickupdate.htm);
}
whatever values of  $tsp  $tsnow are .
well WHERE THE PROBLEM IS ?
*mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
*
http://us.f610.mail.yahoo.com/ym/[EMAIL PROTECTED]
[EMAIL PROTECTED]
*   Leonidas Savvides

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


Re: [PHP] php: else if problem

2005-03-22 Thread Richard Lynch
On Tue, March 22, 2005 1:47 pm, M. Sokolewicz said:
 read the manual, you can use both (else if and elseif).

 The script does exactly what you tell it to. The flaw(s) is(/are) in
 your logic.

else if and elseif are not exactly the same, as the manual indicates
(and glosses over a bit).

The will behave the same, if everything is parallel, but there is a gotcha
when you start embedding nested if/else and if/elseif statements.

If I try to give an example, I'm sure to screw it up, as I never use else
if for this very reason.

But this is the same as in C, and I think any decent C textbook will
diagram for you exactly what goes wrong when you confuse the two.

If you're not sure of the difference, use elseif when the words appear
that close to each other, and you will most likely not hurt yourself that
way.

You only get burned, and that only rarely, if you use else if in my
experience.

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



[PHP] What else can cause unexpected T_SL error other than heredoc?

2004-11-25 Thread D. D. Brierton
We've been getting the following error:

[error] PHP Parse error:  parse error, unexpected T_SL in
/foo/bar.php on line 136

(where foo and bar obviously are stand-ins for real values).

The weird thing is that the file generating the error, bar.php, DOESN'T
contain any heredoc quotations. bar.php was being called by another file,
let's call it baz.php with require_once, and baz.php was also calling
other files using require_once which DID include heredoc quotations, let's
call them heredoc1.php and heredoc2.php. I was able to determine that the
problem was indeed caused by bar.php, and not by anything in heredoc1.php
or heredoc2.php by testing in the following way:

Testing baz.php with the the following commented out:

require_once 'bar.php';
// require_once 'heredoc1.php';
// require_once 'heredoc2.php';

Then testing baz.php with the following commented out:

// require_once 'bar.php';
require_once 'heredoc1.php';
require_once 'heredoc2.php';

In the first test the unexpected T_SL error persisted, whereas in the
second it went away.

But, bar.php does NOT contain any heredoc quoted strings, nor does it
contain anywhere the strings  or . So what could be the cause of
the T_SL error?

This is PHP 4.3.8 on Linux kernel 2.4.20 and Apache 1.3.31.

TIA, Darren

-- 
==
D. D. Brierton[EMAIL PROTECTED]   www.dzr-web.com
   Trying is the first step towards failure (Homer Simpson)
==

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



Re: [PHP] What else can cause unexpected T_SL error other than heredoc?

2004-11-25 Thread Greg Donald
On Thu, 25 Nov 2004 12:17:01 +, D. D. Brierton [EMAIL PROTECTED] wrote:
 We've been getting the following error:
 
 [error] PHP Parse error:  parse error, unexpected T_SL in
 /foo/bar.php on line 136

Can you post some of this code?  Are all your heredoc instances
completely left justified?

 (where foo and bar obviously are stand-ins for real values).
 
 The weird thing is that the file generating the error, bar.php, DOESN'T
 contain any heredoc quotations. bar.php was being called by another file,
 let's call it baz.php with require_once, and baz.php was also calling
 other files using require_once which DID include heredoc quotations, let's
 call them heredoc1.php and heredoc2.php. I was able to determine that the
 problem was indeed caused by bar.php, and not by anything in heredoc1.php
 or heredoc2.php by testing in the following way:
 
 Testing baz.php with the the following commented out:
 
 require_once 'bar.php';
 // require_once 'heredoc1.php';
 // require_once 'heredoc2.php';
 
 Then testing baz.php with the following commented out:
 
 // require_once 'bar.php';
 require_once 'heredoc1.php';
 require_once 'heredoc2.php';
 
 In the first test the unexpected T_SL error persisted, whereas in the
 second it went away.
 
 But, bar.php does NOT contain any heredoc quoted strings, nor does it
 contain anywhere the strings  or . So what could be the cause of
 the T_SL error?

I dunno if that's just a typo in your post, but heredoc requires 3 
or , not two as you wrote.

Are you using any sort of PHP cache by chance?


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] What else can cause unexpected T_SL error other than heredoc?

2004-11-25 Thread D. D. Brierton
On Thu, 25 Nov 2004 06:26:22 -0600, Greg Donald wrote:

 On Thu, 25 Nov 2004 12:17:01 +, D. D. Brierton [EMAIL PROTECTED] wrote:
 We've been getting the following error:
 
 [error] PHP Parse error:  parse error, unexpected T_SL in
 /foo/bar.php on line 136
 
 Can you post some of this code?  Are all your heredoc instances
 completely left justified?

Okay, from baz.php:

// load environment settings
require_once '../common/re5ult_settings.php'; // bar.php in my example
require_once '../common/re5ult_utils.php';// heredoc1.php
require_once '../common/re5ult_xml.php';  // heredoc2.php

All of the heredoc instances were fine (as I think demonstrated by
commenting out the reference to re5ult_settings.php but NOT to the files
which contain the heredoc instances). Here is an example of one of them:

echo EOMSG

/td
/tr
/table
/body
/html
EOMSG;


 But, bar.php does NOT contain any heredoc quoted strings, nor does it
 contain anywhere the strings  or . So what could be the cause of
 the T_SL error?
 
 I dunno if that's just a typo in your post, but heredoc requires 3 
 or , not two as you wrote.

My point being that the file that certainly appears to be causing the
problem doesn't contain the string  or  and therefore nor does it
contain  or .

 Are you using any sort of PHP cache by chance?

No.

Thanks for helping.

Best, Darren

-- 
==
D. D. Brierton[EMAIL PROTECTED]   www.dzr-web.com
   Trying is the first step towards failure (Homer Simpson)
==

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



[PHP] If Else Syntax Incorrect (I Think)

2004-08-13 Thread Harlequin
Can someone help with this please...?

if( strlen( $UserID ) != 0
 strlen( $UserPassword ) != 0
 strlen( $SecretPassword ) != 0
 strlen( $UserMail ) != 0 )
{
Do something
}
elseif ( strlen( $UserID ) == 0
or strlen( $UserPassword ) == 0
or strlen( $SecretPassword ) == 0
or strlen( $UserMail ) == 0 )
{
Do Something else
}

-- 
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-

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



Re: [PHP] If Else Syntax Incorrect (I Think)

2004-08-13 Thread Jason Wong
On Friday 13 August 2004 19:33, Harlequin wrote:
 Can someone help with this please...?

 if( strlen( $UserID ) != 0
  strlen( $UserPassword ) != 0
  strlen( $SecretPassword ) != 0
  strlen( $UserMail ) != 0 )
 {
 Do something
 }
 elseif ( strlen( $UserID ) == 0
 or strlen( $UserPassword ) == 0
 or strlen( $SecretPassword ) == 0
 or strlen( $UserMail ) == 0 )
 {
 Do Something else
 }

WHAT help did you want? Not all of us are mindreaders.

1) State what you want to do (preferably in English -- as opposed to code)
2) State what you did (probably in code)
3) State what you expected to happen
4) State what actually happened, along with error messages if appropriate

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Who is John Galt?
*/

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



RE: [PHP] If Else Syntax Incorrect (I Think)

2004-08-13 Thread Jay Blanchard
[snip]
Can someone help with this please...?

if( strlen( $UserID ) != 0
 strlen( $UserPassword ) != 0
 strlen( $SecretPassword ) != 0
 strlen( $UserMail ) != 0 )
{
Do something
}
elseif ( strlen( $UserID ) == 0
or strlen( $UserPassword ) == 0
or strlen( $SecretPassword ) == 0
or strlen( $UserMail ) == 0 )
{
Do Something else
}
[/snip]

if( strlen( $UserID ) != 0
 strlen( $UserPassword ) != 0
 strlen( $SecretPassword ) != 0
 strlen( $UserMail ) != 0 )
{
Do something
}
elseif ( strlen( $UserID ) == 0
|| strlen( $UserPassword ) == 0
|| strlen( $SecretPassword ) == 0
|| strlen( $UserMail ) == 0 )
{
Do Something else
}

http://us4.php.net/language.operators
http://us4.php.net/manual/en/language.operators.logical.php

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



RE: [PHP] If Else Syntax Incorrect (I Think)

2004-08-13 Thread Ford, Mike [LSS]
On 13 August 2004 12:52, Jay Blanchard wrote:

 if( strlen( $UserID ) != 0
  strlen( $UserPassword ) != 0
  strlen( $SecretPassword ) != 0
  strlen( $UserMail ) != 0 )
 {
 Do something
 }
 elseif ( strlen( $UserID ) == 0
   strlen( $UserPassword ) == 0
   strlen( $SecretPassword ) == 0
   strlen( $UserMail ) == 0 )
 {
 Do Something else
 }

In fact since the elseif condition is the exact logical complement of the if condition 
(by application of deMorgan's rules), you only need:

  if( strlen( $UserID ) != 0
  strlen( $UserPassword ) != 0
  strlen( $SecretPassword ) != 0
  strlen( $UserMail ) != 0 )
  {
Do something
  }
  else
  {
Do Something else
  }

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



[PHP] if..else condition for checkbox

2003-10-01 Thread irinchiang

Hi all, 
   May I just ask how do I do a if..elseif..else condition to check if a
checkbox have been checked. For some reference, I have attached my HTML code
and  PHP code below:

HTML:
html
head
titlePayment Mode/title
style type=text/css
@import url(receipt.css);
/style
/head
body
form action=checkbox.php method=get
brbrbr
div id=pagecontent1
div class=sectionheading
Payment Mode:br
/div
  div class=lighter
  input type=checkbox name=Cash value=Cash Cashbr
  /div
  div class=darker
  input type=checkbox name=Nets value=NetsNetsbr
  /div

  div class=lighter
  input type=checkbox name=Cheque value=ChequeChequebr/divbr
div class=sectionheading
*For Cheque plus Cash payment only:
/div
 div class=lighter
Cheque: $ input name=cheque type=text size=6 maxlength=6br
/div
div class=darker
Cash:   $ input name=cash type=text size=6 maxlength=6br/divbr

input type=submit name=submit value=submit align=center
/div
/form
/form
/body/html


PHP Code:
HTML
HEAD
titlePayment Mode/title
style type=text/css
@import url(receipt.css);
/style
/HEAD
BODY
brbr
div id=pagecontent1
div class=sectionheading
br
tr
td valign=top class=darker width=200
?php
}
?
?php echo Payment Mode:Cash Plus Cheque; ?
br
/div
/td
  Cash: ?php echo $$_GET[cheque];?BR
  Cheque:?php echo $$_GET[cash];?BR


   br
   ?php
   $total = $_GET[cheque] + $_GET[cash];
   $total=number_format($total, 2, .,  );

echo BRTotal payable: $$totalBRBR;
?
/div
/BODY
/HTML

Regards, 
Irin.

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



[PHP] if else while statement speed

2003-09-03 Thread Dan Anderson
I have a function where I have:

?php
while (something())
{
  if ($option1)
  { do_1(); }
  elseif ($option2)
  { do_2(); }
  // ... continue for 10 or more options...
}
?

would it be quicker to do the above code or:

if ($option1)
{
  while(something())
  { do_1(); }
}
elseif ($option2)
{
  while (something())
  { do_2(); }
}
  // ... continue for 10 or more options...

Thanks,

Dan

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



RE: [PHP] if else while statement speed

2003-09-03 Thread Jay Blanchard
[snip]
?php
if ($option1)
{
  while(something())
  { do_1(); }
}
elseif ($option2)
{
  while (something())
  { do_2(); }
}
  // ... continue for 10 or more options...
[/snip]

Theoretically the second one is faster because it only executes the
while loop when the condition is met. The first one will loop through
all of them unless you break; after the suplied conditions.

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



Re: [PHP] if else while statement speed

2003-09-03 Thread Chris Sherwood
have you thought about usiing a switch statement that way all the if or else
if statements are not checked against?

ie
?php
while (something())
{
switch($option)
{
case $option1:
break;

case $option2:
break;

case $... etc
break;
}// end of
}


   if ($option1)
   { do_1(); }
   elseif ($option2)
   { do_2(); }
   // ... continue for 10 or more options...
 }
 ?

- Original Message - 
From: Dan Anderson [EMAIL PROTECTED]
To: PHP List [EMAIL PROTECTED]
Sent: Wednesday, September 03, 2003 10:25 AM
Subject: [PHP] if else while statement speed


 I have a function where I have:

 ?php
 while (something())
 {
   if ($option1)
   { do_1(); }
   elseif ($option2)
   { do_2(); }
   // ... continue for 10 or more options...
 }
 ?

 would it be quicker to do the above code or:

 if ($option1)
 {
   while(something())
   { do_1(); }
 }
 elseif ($option2)
 {
   while (something())
   { do_2(); }
 }
   // ... continue for 10 or more options...

 Thanks,

 Dan

 -- 
 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] Re: Else If/Elseif

2003-06-30 Thread Tularis
Stevie Peele wrote:
What is the difference between else if and elseif?

Thanks

_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

else if shouldn't be used, use elseif, and the difference is non-existant

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


Re: [PHP] Re: Else If/Elseif

2003-06-30 Thread Reuben D. Budiardja
On Monday 30 June 2003 09:41 am, Tularis wrote:
 Stevie Peele wrote:
  What is the difference between else if and elseif?
 
 
  Thanks
 
  _
  STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
  http://join.msn.com/?page=features/junkmail

 else if shouldn't be used, use elseif, and the difference is non-existant

why not? If there's no difference, there is no difference. Meaning you can use 
one or the other. It's user preference. 

RDB


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



[PHP] if else if statement failed...

2003-06-26 Thread Scott Fletcher
Hi!

   Noticed something interesting.  I was helping to debug someone's
programming problem and found that if there is to many 'else if' in the if
and else statement then it doesn't work.  Have anyone encoutered this
problem and know of a workaround to it?

Thanks,
 Scott



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



RE: [PHP] if else if statement failed...

2003-06-26 Thread Dan Joseph
Hi,

Noticed something interesting.  I was helping to debug someone's
 programming problem and found that if there is to many 'else if' in the if
 and else statement then it doesn't work.  Have anyone encoutered this
 problem and know of a workaround to it?

That sounds kinda bizzare, how many elseif's did you have?  also, were you
using 'else if' or 'elseif'?

-Dan Joseph


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



RE: [PHP] if else if statement failed...

2003-06-26 Thread Jay Blanchard
[snip]
Noticed something interesting.  I was helping to debug someone's
programming problem and found that if there is to many 'else if' in the
if
and else statement then it doesn't work.  Have anyone encoutered this
problem and know of a workaround to it?
[/snip]

I'd have to see the code

Jay

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



Re: [PHP] if else if statement failed...

2003-06-26 Thread Scott Fletcher
I am seeing the problem now.  It seem that it had to do with the 'OR'
statement inside the elseif statement...  I'm going to try a workaround to
it...  As for you mentioning about the code...  It's too bad this message
window doesn't properly display the tabs

--clip--
if ($firstname == \\) {echo \Enter [First Name]\; return false;}

elseif ($lastname == \\) {echo \Enter [Last Name]\; return false;}

elseif ($address == \\) {echo \Enter [Address]\; return false;}

elseif ($city == \\) {echo \Enter [City]\; return false;}

elseif ($state == \\) {echo \Enter [State]\; return false;}

elseif ($zipcode == \\) {echo \Enter [Zip Code]\; return false;}

elseif ($homephoneno == \\) {echo \Enter [Home Phone #]\; return false;}

elseif ($dob == \\) {echo \Enter [Date of Birth]\; return false;}

elseif ($ssn == \\) {echo \Enter [Social Security No]\; return false;}

elseif ($dln == \\) {echo \Enter [Driver\'s License No]\; return false;}

elseif ($occupation == \\) {echo \Enter [Occupation]\; return false;}

elseif ($months == \\) {echo \Enter [Residence Months]\; return false;}

elseif ($rentown == \Renting\ || $rentown == \Lease\ || $rentown ==
\Buying House W/Mortgage\) {

/*

if ($towhompaid == \\) {echo \Enter [To Whom Paid]\; return false;}

elseif ($paymentaddress == \\) {echo \Enter [Home Payment Address]\;
return false;}

elseif ($paymentcity == \\) {echo \Enter [Home Payment City]\; return
false;}

elseif ($paymentstate == \\) {echo \Enter [Home Payment State]\; return
false;}

elseif ($paymentzipcode == \\) {echo \Enter [Home Payment Zip Code]\;
return false;}

*/

}

/*

elseif ($income == \\) {echo \Enter [Income]\; return false;}

elseif ($typeofincome == \\  $otherincome  0) {echo \Enter [Type of
Income]\; return false;}

elseif ($bankname == \\) {echo \Enter [Bank Name]\; return false;}

elseif ($Jfirstname != \\  $Jlastname == \\) {echo \Enter Cobuyer\'s
[Last Name]\; return false;}

elseif ($Jfirstname != \\  $Jaddress == \\) {echo \Enter Cobuyer\'s
[Address]\; return false;}

elseif ($Jfirstname != \\  $Jcity == \\) {echo \Enter Cobuyer\'s
[City]\; return false;}

elseif ($Jfirstname != \\  $Jstate == \\) {echo \Enter Cobuyer\'s
[State]\; return false;}

elseif ($Jfirstname != \\  $Jzipcode == \\) {echo \Enter Cobuyer\'s
[Zip Code]\; return false;}

elseif ($Jfirstname != \\  $Jhomephoneno == \\) {echo \Enter
Cobuyer\'s [Home Phone #]\; return false;}

elseif ($Jfirstname != \\  $Jdob == \\) {echo \Enter Cobuyer\'s [Date
of Birth]\; return false;}

elseif ($Jfirstname != \\  $Jssn == \\) {echo \Enter Cobuyer\'s
[Social Security No]\; return false;}

elseif ($Jfirstname != \\  $Jdln == \\) {echo \Enter Cobuyer\'s
[Driver\'s License No]\; return false;}

elseif ($Jfirstname != \\  $Joccupation == \\) {echo \Enter
Cobuyer\'s [Occupation]\; return false;}

elseif ($Jfirstname != \\  $Jmonths == \\) {echo \Enter Cobuyer\'s
[Residence Months]\; return false;}

elseif ($Jfirstname != \\  ($Jrentown == \Renting\ || $Jrentown ==
\Lease\ || $Jrentown == \Buying House W/Mortgage\)) {

if ($Jfirstname != \\  $Jtowhompaid == \\) {echo \Enter Cobuyer\'s
[To Whom Paid]\; return false;}

elseif ($Jfirstname != \\  $Jpaymentaddress == \\) {echo \Enter
Cobuyer\'s [Home Payment Address]\; return false;}

elseif ($Jfirstname != \\  $Jpaymentcity == \\) {echo \Enter
Cobuyer\'s [Home Payment City]\; return false;}

elseif ($Jfirstname != \\  $Jpaymentstate == \\) {echo \Enter
Cobuyer\'s [Home Payment State]\; return false;}

elseif ($Jfirstname != \\  $Jpaymentzipcode == \\) {echo \Enter
Cobuyer\'s [Home Payment Zip Code]\; return false;}

}

elseif ($Jfirstname != \\  $Jincome == \\) {echo \Enter Cobuyer\'s
[Income]\; return false;}

elseif ($Jfirstname != \\  $Jtypeofincome == \\  $Jotherincome  0)
{echo \Enter Cobuyer\'s [Type of Income]\; return false;}

elseif ($Jfirstname != \\  $Jbankname == \\) {echo \Enter Cobuyer\'s
[Bank Name]\; return false;} */

else

return $returnvalue = \Pass\;

--clip--



Jay Blanchard [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
[snip]
Noticed something interesting.  I was helping to debug someone's
programming problem and found that if there is to many 'else if' in the
if
and else statement then it doesn't work.  Have anyone encoutered this
problem and know of a workaround to it?
[/snip]

I'd have to see the code

Jay



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



Re: [PHP] if else if statement failed...

2003-06-26 Thread Scott Fletcher
Just found the problem, the if, else-if, else statement work okay when it is
too many.  The reason it doesn't work is because there's a loophole in the
script due to someone's flaw logic or haven't thought about it when
brainstorming...

Thanks,
 Scott

Scott Fletcher [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I am seeing the problem now.  It seem that it had to do with the 'OR'
 statement inside the elseif statement...  I'm going to try a workaround to
 it...  As for you mentioning about the code...  It's too bad this message
 window doesn't properly display the tabs

 --clip--
 if ($firstname == \\) {echo \Enter [First Name]\; return false;}

 elseif ($lastname == \\) {echo \Enter [Last Name]\; return false;}

 elseif ($address == \\) {echo \Enter [Address]\; return false;}

 elseif ($city == \\) {echo \Enter [City]\; return false;}

 elseif ($state == \\) {echo \Enter [State]\; return false;}

 elseif ($zipcode == \\) {echo \Enter [Zip Code]\; return false;}

 elseif ($homephoneno == \\) {echo \Enter [Home Phone #]\; return
false;}

 elseif ($dob == \\) {echo \Enter [Date of Birth]\; return false;}

 elseif ($ssn == \\) {echo \Enter [Social Security No]\; return false;}

 elseif ($dln == \\) {echo \Enter [Driver\'s License No]\; return
false;}

 elseif ($occupation == \\) {echo \Enter [Occupation]\; return false;}

 elseif ($months == \\) {echo \Enter [Residence Months]\; return
false;}

 elseif ($rentown == \Renting\ || $rentown == \Lease\ || $rentown ==
 \Buying House W/Mortgage\) {

 /*

 if ($towhompaid == \\) {echo \Enter [To Whom Paid]\; return false;}

 elseif ($paymentaddress == \\) {echo \Enter [Home Payment Address]\;
 return false;}

 elseif ($paymentcity == \\) {echo \Enter [Home Payment City]\; return
 false;}

 elseif ($paymentstate == \\) {echo \Enter [Home Payment State]\;
return
 false;}

 elseif ($paymentzipcode == \\) {echo \Enter [Home Payment Zip Code]\;
 return false;}

 */

 }

 /*

 elseif ($income == \\) {echo \Enter [Income]\; return false;}

 elseif ($typeofincome == \\  $otherincome  0) {echo \Enter [Type of
 Income]\; return false;}

 elseif ($bankname == \\) {echo \Enter [Bank Name]\; return false;}

 elseif ($Jfirstname != \\  $Jlastname == \\) {echo \Enter
Cobuyer\'s
 [Last Name]\; return false;}

 elseif ($Jfirstname != \\  $Jaddress == \\) {echo \Enter Cobuyer\'s
 [Address]\; return false;}

 elseif ($Jfirstname != \\  $Jcity == \\) {echo \Enter Cobuyer\'s
 [City]\; return false;}

 elseif ($Jfirstname != \\  $Jstate == \\) {echo \Enter Cobuyer\'s
 [State]\; return false;}

 elseif ($Jfirstname != \\  $Jzipcode == \\) {echo \Enter Cobuyer\'s
 [Zip Code]\; return false;}

 elseif ($Jfirstname != \\  $Jhomephoneno == \\) {echo \Enter
 Cobuyer\'s [Home Phone #]\; return false;}

 elseif ($Jfirstname != \\  $Jdob == \\) {echo \Enter Cobuyer\'s
[Date
 of Birth]\; return false;}

 elseif ($Jfirstname != \\  $Jssn == \\) {echo \Enter Cobuyer\'s
 [Social Security No]\; return false;}

 elseif ($Jfirstname != \\  $Jdln == \\) {echo \Enter Cobuyer\'s
 [Driver\'s License No]\; return false;}

 elseif ($Jfirstname != \\  $Joccupation == \\) {echo \Enter
 Cobuyer\'s [Occupation]\; return false;}

 elseif ($Jfirstname != \\  $Jmonths == \\) {echo \Enter Cobuyer\'s
 [Residence Months]\; return false;}

 elseif ($Jfirstname != \\  ($Jrentown == \Renting\ || $Jrentown ==
 \Lease\ || $Jrentown == \Buying House W/Mortgage\)) {

 if ($Jfirstname != \\  $Jtowhompaid == \\) {echo \Enter Cobuyer\'s
 [To Whom Paid]\; return false;}

 elseif ($Jfirstname != \\  $Jpaymentaddress == \\) {echo \Enter
 Cobuyer\'s [Home Payment Address]\; return false;}

 elseif ($Jfirstname != \\  $Jpaymentcity == \\) {echo \Enter
 Cobuyer\'s [Home Payment City]\; return false;}

 elseif ($Jfirstname != \\  $Jpaymentstate == \\) {echo \Enter
 Cobuyer\'s [Home Payment State]\; return false;}

 elseif ($Jfirstname != \\  $Jpaymentzipcode == \\) {echo \Enter
 Cobuyer\'s [Home Payment Zip Code]\; return false;}

 }

 elseif ($Jfirstname != \\  $Jincome == \\) {echo \Enter Cobuyer\'s
 [Income]\; return false;}

 elseif ($Jfirstname != \\  $Jtypeofincome == \\  $Jotherincome 
0)
 {echo \Enter Cobuyer\'s [Type of Income]\; return false;}

 elseif ($Jfirstname != \\  $Jbankname == \\) {echo \Enter
Cobuyer\'s
 [Bank Name]\; return false;} */

 else

 return $returnvalue = \Pass\;

 --clip--



 Jay Blanchard [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 [snip]
 Noticed something interesting.  I was helping to debug someone's
 programming problem and found that if there is to many 'else if' in the
 if
 and else statement then it doesn't work.  Have anyone encoutered this
 problem and know of a workaround to it?
 [/snip]

 I'd have to see the code

 Jay





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



Re: [PHP] if else if statement failed...

2003-06-26 Thread Ernest E Vogelsinger
At 22:09 26.06.2003, Scott Fletcher said:
[snip]
I am seeing the problem now.  It seem that it had to do with the 'OR'
statement inside the elseif statement...  I'm going to try a workaround to
it...  As for you mentioning about the code...  It's too bad this message
window doesn't properly display the tabs
[snip] 

I have a little piece of code for you that may help cleaning up your
if/elseif sequence. Not tested  may contain typos  use on your own
risk. Hope the list doesn't clutter it too much...

This multi-dimensional array should make it quite easy to manage such
situations. The main array consists of a series of sub-arrays (structures
containing these elements:
- 'expr' - if this evaluates to TRUE, the following checks are performed
- 'check' - an array of fieldname = error message
- 'pattern' - a pattern for sprintf to format the message

fieldname is assumed to be a $_REQUEST element that is checked for
emptiness. If empty, the message is issued (just as in your code) and the
function returns false. If no error occurs throughout the tests, the
function returns Pass (I'd prefer true).

$test_map = array(
   array('expr'= 'true',
 'pattern' = 'Enter [%s]',
 'check'   = array('firstname'   = 'First Name',
'lastname'= 'Last Name',
'address' = 'Address',
'city'= 'City',
'state'   = 'State',
'zipcode' = 'Zip Code',
'homephoneno' = 'Home Phone #',
'dob' = 'Date of Birth',
'ssn' = 'Social Security No',
'dln' = 'Driver\'s License No',
'occupation'  = 'Occupation',
'months'  = 'Residence Months',
   ),
),
   array('expr'= 'in_array(\$_REQUEST[\'rentown\'],' .
  ' array(\'Renting\', \'Lease\',' .
  ' \'Buying House W/Mortgage\')',
 'pattern' = 'Enter [%s]',
 'check'   = array('towhompaid'  = 'To Whom Paid',
'paymentaddress'  = 'Home Payment Address',
'paymentcity' = 'Home Payment City',
'paymentstate'= 'Home Payment State',
'paymentzipcode'  = 'Home Payment Zipcode',
   ),
),
   array('expr'= 'true',
 'pattern' = 'Enter [%s]',
 'check'   = array('income'  = 'Income',
   ),
),
   array('expr'= '\$_REQUEST[\'otherincome\']  0',
 'pattern' = 'Enter [%s]',
 'check'   = array('typeofincome'= 'Type of Income',
   ),
),
   array('expr'= 'true',
 'pattern' = 'Enter [%s]',
 'check'   = array('bankname'= 'Bank Name',
   ),
),
   array('expr'= '!empty(\$_REQUEST[\'Jfirstname\'])',
 'pattern' = 'Enter Cobuyer\'s [%s]',
 'check'   = array('Jlastname'   = 'Last Name',
'Jaddress'= 'Address',
'Jcity'   = 'City',
'Jstate'  = 'State',
'Jzipcode'= 'Zip Code',
'Jhomephoneno'= 'Home Phone #',
'Jdob'= 'Date of Birth',
'Jssn'= 'Social Security No',
'Jdln'= 'Driver\'s License No',
'Joccupation' = 'Occupation',
'Jmonths' = 'Residence Months',
   ),
),
   array('expr'= '!empty(\$_REQUEST[\'Jfirstname\'])' .
  '  in_array(\$_REQUEST[\'Jtowhompaid\'],' .
  ' array(\'Renting\', \'Lease\', \'Buying House
W/Mortgage\'))',
 'pattern' = 'Enter Cobuyer\'s [%s]',
 'check'   = array('Jtowhompaid' = 'To Whom Paid',
'Jpaymentaddress' = 'Home Payment Address',
'Jpaymentcity'= 'Home Payment City',
'Jpaymentstate'   = 'Home Payment State',
'Jpaymentzipcode' = 'Home Payment Zip Code',
   ),
),
   array('expr'= '!empty(\$_REQUEST[\'Jfirstname\'])',
 'pattern' = 'Enter Cobuyer\'s [%s]',
 'check'   = array('Jincome' = 'Income',
'Jtypeofincome'   = 'Type of Income',
'Jbankname'   = 'Bank Name',
   ),
 

[PHP] If else.. display no picture..

2003-04-05 Thread fkeessen
Hi,

I'm trying to do the following.. When $stadpict is filled in it must display the 
picture (only the path to the picture is stored in Mysql). But when the string 
($stadpict) is empty then it must not display the picture (and also not display a box 
with a red cross in it (can't display picture! ;). The only thing i'm getting is an 
error message...

Parse error: parse error, unexpected T_STRING, expecting ',' or ';' 

Code;
?
// includes
include(../conf/config.php);

// open database connection
$connection = mysql_connect($host, $user, $pass) or die (Unable to connect!);

// select database
mysql_select_db($db) or die (Unable to select database!);
$stedenid=$_GET['stedenid'];

// generate and execute query
$query2 = SELECT stedenid, naamstad, stadomschrijvk, stadpict FROM steden WHERE 
stedenid = $stedenid;
$result2 = mysql_query($query2) or die (Error in query: $query2.  . mysql_error());
$row2 = mysql_fetch_object($result2);
if (mysql_num_rows($result2)  0)
{
?

font class=bold? echo $row2-naamstad; ? /font
brbr? echo $row2-stadpict; 
?

/td
/tr
 /table
 table cellspacing=0  width=405 cellpadding=0 border=0
tr style=padding-top:10
td width=139 valign=top style=padding-left:20
 ? 
   
while($row-$stadpict  0)
{
?
img src=../steden/images/? echo $row-stadpict; ? border=0 width=108 
height=160 alt=/td
?
}
 ?
td width=266 valign=top style=padding-right:10;padding-left:10? echo 
$row2-stadomschrijvk; 
}
else

{
Echo Geen informatie beschikbaar;
}
?


Thanks for helping me out!

Frank

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

RE: [PHP] If else.. display no picture..

2003-04-05 Thread John W. Holmes
 I'm trying to do the following.. When $stadpict is filled in it must
 display the picture (only the path to the picture is stored in Mysql).
But
 when the string ($stadpict) is empty then it must not display the
picture
 (and also not display a box with a red cross in it (can't display
picture!
 ;). The only thing i'm getting is an error message...
 
 Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
 
 Code;
 ?
 // includes
 include(../conf/config.php);
 
 // open database connection
 $connection = mysql_connect($host, $user, $pass) or die (Unable to
 connect!);
 
 // select database
 mysql_select_db($db) or die (Unable to select database!);
 $stedenid=$_GET['stedenid'];
 
 // generate and execute query
 $query2 = SELECT stedenid, naamstad, stadomschrijvk, stadpict FROM
steden
 WHERE stedenid = $stedenid;
 $result2 = mysql_query($query2) or die (Error in query: $query2.  .
 mysql_error());
 $row2 = mysql_fetch_object($result2);
 if (mysql_num_rows($result2)  0)
 {
 ?
 
 font class=bold? echo $row2-naamstad; ? /font
 brbr? echo $row2-stadpict;
 ?
 
 /td
 /tr
  /table
  table cellspacing=0  width=405 cellpadding=0 border=0
 tr style=padding-top:10
 td width=139 valign=top style=padding-left:20
  ?
 
  while($row-$stadpict  0)
 {
 ?
 img src=../steden/images/? echo $row-stadpict; ? border=0
 width=108 height=160 alt=/td
 ?
 }
  ?
 td width=266 valign=top
style=padding-right:10;padding-left:10?
 echo $row2-stadomschrijvk;
 }
 else
 
 {
 Echo Geen informatie beschikbaar;

What is this line supposed to do? You're missing some quotes around your
string...

Next time it would be more helpful if you posted the _exact_ error
message along with the relevant line mentioned in the message and 5 or
so lines before that one. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



Re: [PHP] If else.. display no picture..

2003-04-05 Thread Rasmus Lerdorf
I would help if you told us which line the error was on

On Sat, 5 Apr 2003 [EMAIL PROTECTED] wrote:

 Hi,

 I'm trying to do the following.. When $stadpict is filled in it must display the 
 picture (only the path to the picture is stored in Mysql). But when the string 
 ($stadpict) is empty then it must not display the picture (and also not display a 
 box with a red cross in it (can't display picture! ;). The only thing i'm getting 
 is an error message...

 Parse error: parse error, unexpected T_STRING, expecting ',' or ';'

 Code;
 ?
 // includes
 include(../conf/config.php);

 // open database connection
 $connection = mysql_connect($host, $user, $pass) or die (Unable to connect!);

 // select database
 mysql_select_db($db) or die (Unable to select database!);
 $stedenid=$_GET['stedenid'];

 // generate and execute query
 $query2 = SELECT stedenid, naamstad, stadomschrijvk, stadpict FROM steden WHERE 
 stedenid = $stedenid;
 $result2 = mysql_query($query2) or die (Error in query: $query2.  . mysql_error());
 $row2 = mysql_fetch_object($result2);
 if (mysql_num_rows($result2)  0)
 {
 ?

 font class=bold? echo $row2-naamstad; ? /font
 brbr? echo $row2-stadpict;
 ?

 /td
 /tr
  /table
  table cellspacing=0  width=405 cellpadding=0 border=0
 tr style=padding-top:10
 td width=139 valign=top style=padding-left:20
  ?
  
 while($row-$stadpict  0)
 {
 ?
 img src=../steden/images/? echo $row-stadpict; ? border=0 width=108 
 height=160 alt=/td
 ?
 }
  ?
 td width=266 valign=top style=padding-right:10;padding-left:10? echo 
 $row2-stadomschrijvk;
 }
 else

 {
 Echo Geen informatie beschikbaar;
 }
 ?


 Thanks for helping me out!

 Frank



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



[PHP] If... Else.. I'm not getting it!

2003-01-25 Thread Frank Keessen
Hi all,

Please can you help me with the following:

If got a little sample code:

This one is working (!):

?php
$vname=$_POST['vname'];
echo hello $vname;
?
form action=? echo ($_SERVER['PHP_SELF']); ? method=post
table
trtdInput yourname/tdtdinput type=text name=vname/td/tr
trtd colspan=2input type=submit name=submit/td/tr
/table
/form
?php

?

But when i'm using IF Else.. Nothing is happening. I'm only seeing the form but when i 
submit that form: The $vname doen't display..

Here is the code that doesn't work:

?php
$vname=$_POST['vname'];
if($submit) {
echo hello $vname;
} else {
?
form action=? echo ($_SERVER['PHP_SELF']); ? method=post
table
trtdInput yourname/tdtdinput type=text name=vname/td/tr
trtd colspan=2input type=submit name=submit/td/tr
/table
/form
?php
}
?

What am I doing wrong???

Thanks,

Frank




Re: [PHP] If... Else.. I'm not getting it!

2003-01-25 Thread Jason Wong
On Saturday 25 January 2003 18:27, Frank Keessen wrote:

 But when i'm using IF Else.. Nothing is happening. I'm only seeing the form
 but when i submit that form: The $vname doen't display..

 Here is the code that doesn't work:

 ?php
 $vname=$_POST['vname'];
 if($submit) {

Try some basic debugging techniques like echo ($submit). You'll see nothing, 
hence that IF clause fails.

If register_globals is not enabled then you need to use $_POST['submit'] (just 
as you had to use $_POST['vname']).

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

/*
Confidence is simply that quiet, assured feeling you have before you
fall flat on your face.
-- Dr. L. Binder
*/


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




Re: [PHP] If... Else.. I'm not getting it!

2003-01-25 Thread Frank Keessen
Hi,

The register_globals = Off. Dit the basic echo ($submit) but it displays
nothing..

Any thoughts somebody??

Thanks for helping me out on this cloudy saturday (in Amsterdam!)

Regards,

Frank

- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, January 25, 2003 11:36 AM
Subject: Re: [PHP] If... Else.. I'm not getting it!


 On Saturday 25 January 2003 18:27, Frank Keessen wrote:

  But when i'm using IF Else.. Nothing is happening. I'm only seeing the
form
  but when i submit that form: The $vname doen't display..
 
  Here is the code that doesn't work:
 
  ?php
  $vname=$_POST['vname'];
  if($submit) {

 Try some basic debugging techniques like echo ($submit). You'll see
nothing,
 hence that IF clause fails.

 If register_globals is not enabled then you need to use $_POST['submit']
(just
 as you had to use $_POST['vname']).

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

 /*
 Confidence is simply that quiet, assured feeling you have before you
 fall flat on your face.
 -- Dr. L. Binder
 */


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



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




Re: [PHP] If... Else.. I'm not getting it!

2003-01-25 Thread Johannes Schlueter
Hi,

On Saturday 25 January 2003 12:18, Frank Keessen wrote:
 The register_globals = Off. Dit the basic echo ($submit) but it displays
 nothing..

 Any thoughts somebody??

Switch on register_globals or (better!) use $_GET['submit'], $_POST['submit'] 
or $_REQUEST['submit'].

 Thanks for helping me out on this cloudy saturday (in Amsterdam!)

johannes

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




Re: [PHP] If... Else.. I'm not getting it!

2003-01-25 Thread Frank Keessen
Hi,

Thanks, but i'm a kind of a newbie in PHP and what i've read it's better to
have the register_globals = Off!!! If you look at my code you see that i'm
using the $_GET variable.. This works fine!! It's the IF.. ELSE what gives
me a lot of trouble!

Frank

- Original Message -
From: Johannes Schlueter [EMAIL PROTECTED]
To: Frank Keessen [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, January 25, 2003 12:25 PM
Subject: Re: [PHP] If... Else.. I'm not getting it!


Hi,

On Saturday 25 January 2003 12:18, Frank Keessen wrote:
 The register_globals = Off. Dit the basic echo ($submit) but it displays
 nothing..

 Any thoughts somebody??

Switch on register_globals or (better!) use $_GET['submit'],
$_POST['submit']
or $_REQUEST['submit'].

 Thanks for helping me out on this cloudy saturday (in Amsterdam!)

johannes

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



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




RE: [PHP] If... Else.. I'm not getting it!

2003-01-25 Thread Rich Gray
You are using the post method not get so $_GET[] should be empty.

Does this version of your code work?

?php
if(isset($_POST['submit'])) {
$vname=$_POST['vname'];
echo hello $vname;
} else {
?
form action=? echo ($_SERVER['PHP_SELF']); ? method=post
table
trtdInput yourname/tdtdinput type=text name=vname/td/tr
trtd colspan=2input type=submit name=submit/td/tr
/table
/form
?php
}
?

Rich
-Original Message-
From: Frank Keessen [mailto:[EMAIL PROTECTED]]
Sent: 25 January 2003 11:33
To: Johannes Schlueter; [EMAIL PROTECTED]
Subject: Re: [PHP] If... Else.. I'm not getting it!


Hi,

Thanks, but i'm a kind of a newbie in PHP and what i've read it's better to
have the register_globals = Off!!! If you look at my code you see that i'm
using the $_GET variable.. This works fine!! It's the IF.. ELSE what gives
me a lot of trouble!

Frank


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




Re: [PHP] If... Else.. I'm not getting it!

2003-01-25 Thread Frank Keessen
Wow!! It worked... Sorry for the confusion about the get!!

Thanks guys, i can go further!!! Have a nice weekend!

Regards,

Frank
- Original Message -
From: Rich Gray [EMAIL PROTECTED]
To: Frank Keessen [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, January 25, 2003 12:42 PM
Subject: RE: [PHP] If... Else.. I'm not getting it!


 You are using the post method not get so $_GET[] should be empty.

 Does this version of your code work?

 ?php
 if(isset($_POST['submit'])) {
 $vname=$_POST['vname'];
 echo hello $vname;
 } else {
 ?
 form action=? echo ($_SERVER['PHP_SELF']); ? method=post
 table
 trtdInput yourname/tdtdinput type=text name=vname/td/tr
 trtd colspan=2input type=submit name=submit/td/tr
 /table
 /form
 ?php
 }
 ?

 Rich
 -Original Message-
 From: Frank Keessen [mailto:[EMAIL PROTECTED]]
 Sent: 25 January 2003 11:33
 To: Johannes Schlueter; [EMAIL PROTECTED]
 Subject: Re: [PHP] If... Else.. I'm not getting it!


 Hi,

 Thanks, but i'm a kind of a newbie in PHP and what i've read it's better
to
 have the register_globals = Off!!! If you look at my code you see that i'm
 using the $_GET variable.. This works fine!! It's the IF.. ELSE what gives
 me a lot of trouble!

 Frank


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



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




Re: [PHP] If... Else.. I'm not getting it!

2003-01-25 Thread Jason Wong
On Saturday 25 January 2003 19:18, Frank Keessen wrote:
 Hi,

 The register_globals = Off. Dit the basic echo ($submit) but it displays
 nothing..

 Any thoughts somebody??

  If register_globals is not enabled then you need to use $_POST['submit']

 (just

  as you had to use $_POST['vname']).

!!??!!

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

/*
In matters of principle, stand like a rock;
in matters of taste, swim with the current.
-- Thomas Jefferson
*/


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




[PHP] what else do i need in this upload script?

2002-11-15 Thread Tweak2x
ok, this is upload.php:

form enctype=multipart/form-data action=upload.php method=post
input type=hidden name=MAX_FILE_SIZE value=1000
Send this file: input name=userfile type=file
input type=submit value=Send File
/form


what else do i need to make afile upload?



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




RE: [PHP] what else do i need in this upload script?

2002-11-15 Thread Van Andel, Robert
This looks fine except the MAX_FILE_SIZE looks rather small.  I had an issue
with it earlier this week and found that the fileI was trying to upload was
larger than the MAX_FILE_SIZE.  I believe this is measured in bytes, so your
file cannot be larger than 1KB.  Are you getting any errors?

Robbert van Andel 

-Original Message-
From: Tweak2x [mailto:Tweak2x;Carolina.rr.com]
Sent: Friday, November 15, 2002 1:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP] what else do i need in this upload script?


ok, this is upload.php:

form enctype=multipart/form-data action=upload.php method=post
input type=hidden name=MAX_FILE_SIZE value=1000
Send this file: input name=userfile type=file
input type=submit value=Send File
/form


what else do i need to make afile upload?



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


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





Re: [PHP] what else do i need in this upload script?

2002-11-15 Thread Jason Wong
On Saturday 16 November 2002 05:04, Tweak2x wrote:
 ok, this is upload.php:

 form enctype=multipart/form-data action=upload.php method=post
 input type=hidden name=MAX_FILE_SIZE value=1000
 Send this file: input name=userfile type=file
 input type=submit value=Send File
 /form


 what else do i need to make afile upload?

Why don't just try the example in the manual as someone (I believe) already 
suggested?

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

/*
Satire is what closes Saturday night.
-- George Kaufman
*/


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




Re: [PHP] what else do i need in this upload script?

2002-11-15 Thread tweak2x
it dosnt work for me
- Original Message -
From: Jason Wong [EMAIL PROTECTED]
Newsgroups: php.general
To: [EMAIL PROTECTED]
Sent: Friday, November 15, 2002 4:20 PM
Subject: Re: [PHP] what else do i need in this upload script?


 On Saturday 16 November 2002 05:04, Tweak2x wrote:
  ok, this is upload.php:
 
  form enctype=multipart/form-data action=upload.php method=post
  input type=hidden name=MAX_FILE_SIZE value=1000
  Send this file: input name=userfile type=file
  input type=submit value=Send File
  /form
 
 
  what else do i need to make afile upload?

 Why don't just try the example in the manual as someone (I believe)
already
 suggested?

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

 /*
 Satire is what closes Saturday night.
 -- George Kaufman
 */




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




Re: [PHP] what else do i need in this upload script?

2002-11-15 Thread Jason Wong
On Saturday 16 November 2002 06:54, tweak2x wrote:
 it dosnt work for me

sigh

 http://marc.theaimsgroup.com/?l=php-generalm=103678340124082w=2

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

/*
It is better to remain childless than to father an orphan.
*/


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




[PHP] if/else mail() problem..

2002-08-25 Thread eriol

I've got the following bit of code for an upload/feedback form.. Upload isn't a
required field, but name, email and message are.. When someone submits this form
with an upload used, it works fine.. But if an upload is excluded and they only
fill in the required fields, I don't get an email..

I'm sure this has to do with the if/else statements, but I haven't been able to
figure this out.. If anyone has a suggestion, help or can point me in the right
direction, I'd appreciate it.. TIA..

Take care.. peace..
eriol



$info = NULL;
if(count($_FILES)  0){
  $allowed_types = array(text/plain,text/html);
  $size_limit = 524288;
  $file = $_FILES[file][name];
  $type = $_FILES[file][type];
  $size = $_FILES[file][size];
  $temp = $_FILES[file][tmp_name];
  $path_info = pathinfo($PATH_TRANSLATED);
  $write_path = $path_info[dirname] . $uploadpath$uptime . $file;
  if ($file){
if ($size  $size_limit){
  if (in_array($type,$allowed_types)){
if(move_uploaded_file($temp,$write_path)){
  $info = Thank you .$_REQUEST['name'].\n;
if(!mail($email,$subject,$body,Return-Path: me@$SERVER_NAME\r\n
  .From: me me@$SERVER_NAME\r\n
  .Reply-To: me@$SERVER_NAME\r\n
  .X-Mailer: $SERVER_NAME)){
  if($_REQUEST[submit]){
$null = ;
$name = $_REQUEST['name'];
$from = $_REQUEST['email'];
$message  = $_REQUEST['message'];
  }
  echo uh..;
}
}
else{
  $info = b$file/b wasn't sent due to an error..;
}
  }
  else{
$info = I do not accept b$type/b type files..;
  }
}
else{
  $info = Only files up to b$size_limit/b bytes accepted..;
}
  }
  $info .=\n;
}
echo $info;



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




[PHP] If else question

2002-04-23 Thread Jennifer Downey

Hi all,

I am wondering. When you use an if else statement and a condition exists
isn't the if part suppose to stop?
Then if the condition doesn't exist it is suppose to do something else?

I am wondering because I have a form that goes something like this.

select such and such from the table
if that condition  1
echo that it can't be found
else
echo the form

But in this case even if the condition  1 it still echoes the form.
I am not understanding this.


Thanks for your time and help
Jennifer




--
The sleeper has awaken


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



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




Re: [PHP] If else question

2002-04-23 Thread Miguel Cruz

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

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

So it should be:

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

miguel


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




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey


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

 So it should be:

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

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

Jennifer


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



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




RE: [PHP] If else question

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

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

-Natalie

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



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

 So it should be:

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

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

Jennifer


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



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

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




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey

It shows both.

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

 -Natalie

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



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

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

 Jennifer


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



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


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



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




RE: [PHP] If else question

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

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

-Natalie

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


It shows both.

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

 -Natalie

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



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

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

 Jennifer


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



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


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



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

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




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey


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

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

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

Jennifer




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

 -Natalie

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


 It shows both.

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


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



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


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



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




Re: [PHP] If else question

2002-04-23 Thread -BD-

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




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



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

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

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

 Jennifer




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


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



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



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




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey

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

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




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


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

 So it should be:

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



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



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




Fw: [PHP] If else question

2002-04-23 Thread Richard Emery

OK...this has dragged on...

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

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

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


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

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




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


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

 So it should be:

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



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



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



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




RE: [PHP] If else question

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


Look also at the examples in docs:

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

php.net/header



Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins




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


OK...this has dragged on...

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

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

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


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

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




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


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

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

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

 So it should be:

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

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

RE: [PHP] If else question

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


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


Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins




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


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

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




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


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

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

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

 So it should be:

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

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



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



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



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

RE: [PHP] If else question

2002-04-23 Thread Fifield, Mike

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


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

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

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




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


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

 So it should be:

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



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



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

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




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey

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

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

$user = $row['name'];



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

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


   if($iid == $id)
   {

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

echo $display_blockBRBR;

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

}
else
{

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


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


}

Jennifer



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



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




RE: [PHP] If else question

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



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



?

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

$user = $row['name'];

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

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

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


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

echo $display_blockBRBR;

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


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

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

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

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

}


?


-





Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins




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


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

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

$user = $row['name'];



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

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


   if($iid == $id)
   {

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

echo $display_blockBRBR;

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

}
else
{

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


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


}

Jennifer



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

RE: [PHP] If else question

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

Oh well.

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



Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins




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


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

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

$user = $row['name'];



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

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


   if($iid == $id)
   {

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

echo $display_blockBRBR;

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

}
else
{

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


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


}

Jennifer



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



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



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




RE: [PHP] If else question

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


Try this, Jennifer:

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

$quantity = $row['quantity'];

With this one:

$quantity = 0;

In other words: hardcode it for testing.

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





Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins




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


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

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

$user = $row['name'];



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

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


   if($iid == $id)
   {

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

echo $display_blockBRBR;

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

}
else
{

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


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


}

Jennifer



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



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



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




Re: [PHP] If else question

2002-04-23 Thread Richard Emery

Now, we're getting somewhere!!!

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

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

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

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


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

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

$user = $row['name'];



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

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


   if($iid == $id)
   {

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

echo $display_blockBRBR;

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

}
else
{

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


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


}

Jennifer



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



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



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




Re: [PHP] If else question

2002-04-23 Thread -BD-

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






 Now, we're getting somewhere!!!

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

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

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

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


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

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

 $user = $row['name'];



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

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


if($iid == $id)
{

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

 echo $display_blockBRBR;

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

 }
 else
 {

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


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


 }

 Jennifer



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




RE: [PHP] If else question

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

Jennifer, satus!
People are nervous here!


Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins




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


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

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

$user = $row['name'];



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

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


   if($iid == $id)
   {

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

echo $display_blockBRBR;

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

}
else
{

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


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


}

Jennifer



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



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



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




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey

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






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




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



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




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey

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

 Try this, Jennifer:

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

 $quantity = $row['quantity'];

 With this one:

 $quantity = 0;

 In other words: hardcode it for testing.

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





 Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 www.PHPBeginner.com   // where PHP Begins




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


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

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

 $user = $row['name'];



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

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


if($iid == $id)
{

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

 echo $display_blockBRBR;

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

 }
 else
 {

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


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


 }

 Jennifer



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



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




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



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




Re: [PHP] If else question

2002-04-23 Thread heinisch

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

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

Oliver

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

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

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

 echo $display_blockBRBR;

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

}
else
{

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


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


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




AW: [PHP] If else question

2002-04-23 Thread Red Wingate

H.

I might be wrong but :

 $ret = mysql_query($query);
 while($row = mysql_fetch_array($ret))
 {
 $user = $row['name'];

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

is absolutely wrong ... the first $ret and $row is replaced by the
second $ret and $row, try to change the names of one of those
two pairs and give it another try.

I looks to me as if one row executes the IF and another one the ELSE
Statement ( try to let the script die(); after one the first while.

red
-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 23. April 2002 8:31 PM
An: [EMAIL PROTECTED]
Betreff: Re: [PHP] If else question

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

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

Oliver

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

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

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

 echo $display_blockBRBR;

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

}
else
{

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


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


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



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




Re: [PHP] If else question

2002-04-23 Thread Miguel Cruz

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

  if($submit)

testing false.

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

miguel

On Tue, 23 Apr 2002, Jennifer Downey wrote:

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


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




Re: [PHP] If else question

2002-04-23 Thread Jason Soza

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

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

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

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

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

HTH,

Jason Soza

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

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


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




Re: [PHP] If else question

2002-04-23 Thread Jennifer Downey

I have it. I actually got it!

I had the if statement in the wrong place.

Here is what I did:

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

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


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

and it worked perfectly!

Thank you ALL for your time and help!
Jennifer

P.S. You people are wonderfull!




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



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




[PHP] If...Else question

2002-03-14 Thread Brad Harriger

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

?

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

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

?

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

?

// Now back to the PHP code

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

?

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


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




RE: [PHP] If...Else question

2002-03-14 Thread Vlad Kulchitski

Of course it's legal, absolutely.

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

echo font color=\red\;

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

Vlad

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

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

?

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

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

?

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

?

// Now back to the PHP code

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

?

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


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


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




Re: [PHP] If...Else question

2002-03-14 Thread Nick Winfield

On Thu, 14 Mar 2002, Brad Harriger wrote:

!-- snip --

 ?

 // Now back to the PHP code

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

 ?

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

Replace:

$e = Does not apply.

with:

$e = Does not apply.;

Cheers,

Nick Winfield.


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




[PHP] anyone else been having this problem???

2002-03-01 Thread Ben Turner

I just developed a new site and some of the users that I have go to visit the site are 
prompted (under IE only) to download a language pack. Not sure why and to top all 
of that, the language pack it prompts them to download is blank Meaning the prompt 
doesnt say what language pack.

So if the user downloads it, the page comes up, if not the page is blank (although the 
source is there when they view it).  Sound familiar to anyone?  got any ideas what to 
change/check?

Thanks!
Ben



Re: [PHP] anyone else been having this problem???

2002-03-01 Thread GENESiS DESiGNS

Hmm Whats the web site address?


-GENESiS DESiGNS
-Sean Kennedy
-http://wwwgdesignsvcncom


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




[PHP] If/else conditional statement ...

2001-12-23 Thread Robert Dyke

Hello:

In ASP I can write a Conditional statement like this:

% If $varA == True Then %
Straight HTML in here that only displays if $varA == True
% Else %
Straight HTML in here that only displays if $varA != True
% End if %

Translating this to PHP doesn't work:

? If ($varA == True) {  ?   // error is generated here ...


Is there some way to do it this way in PHP?  I'd rather not create a huge
variable and then echo that.

Thanks in advance.


Robert Dyke
Montana Software
http://www.montanasoft.com/
[EMAIL PROTECTED]

* For the best results please include the text of this message (cut and
paste if necessary) in your reply *






-- 
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/else conditional statement ...

2001-12-23 Thread Bogdan Stancescu

Make sure you close the accolade afterwords in PHP -- other than that, yes,
it works just fine!

For example this should work just fine:
-
?
  for ($i=0;$i10;$i++) {
if (!($i%3)) {
?
  Found a multiple of three!
?
echo($i);
?br?
}
  }
?
--

Bogdan

Robert Dyke wrote:

 Hello:

 In ASP I can write a Conditional statement like this:

 % If $varA == True Then %
 Straight HTML in here that only displays if $varA == True
 % Else %
 Straight HTML in here that only displays if $varA != True
 % End if %

 Translating this to PHP doesn't work:

 ? If ($varA == True) {  ?   // error is generated here ...

 Is there some way to do it this way in PHP?  I'd rather not create a huge
 variable and then echo that.

 Thanks in advance.

 Robert Dyke
 Montana Software
 http://www.montanasoft.com/
 [EMAIL PROTECTED]

 * For the best results please include the text of this message (cut and
 paste if necessary) in your reply *

 --
 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/else conditional statement ...

2001-12-23 Thread Miles Thompson

What's the error, just a parse error on line xx?
O tend to do a lot of echo 'ing, so this suggestion may not be much help.
How about adding a semicolon?
? If ($varA == True) {  ; ?

Miles

At 01:11 PM 12/23/2001 -0700, Robert Dyke wrote:
Hello:

In ASP I can write a Conditional statement like this:

% If $varA == True Then %
Straight HTML in here that only displays if $varA == True
% Else %
Straight HTML in here that only displays if $varA != True
% End if %

Translating this to PHP doesn't work:

? If ($varA == True) {  ?   // error is generated here ...


Is there some way to do it this way in PHP?  I'd rather not create a huge
variable and then echo that.

Thanks in advance.


Robert Dyke
Montana Software
http://www.montanasoft.com/
[EMAIL PROTECTED]

* For the best results please include the text of this message (cut and
paste if necessary) in your reply *






--
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/else conditional statement ...

2001-12-23 Thread Bogdan Stancescu

Took a better look at your code -- you've capitalized true -- that may be
it.

Bogdan


-- 
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/else conditional statement ...

2001-12-23 Thread Michael Sims

At 01:11 PM 12/23/2001 -0700, Robert Dyke wrote:
Hello:

In ASP I can write a Conditional statement like this:

% If $varA == True Then %
Straight HTML in here that only displays if $varA == True
% Else %
Straight HTML in here that only displays if $varA != True
% End if %

Translating this to PHP doesn't work:

? If ($varA == True) {  ?   // error is generated here ...


Is there some way to do it this way in PHP?  I'd rather not create a huge
variable and then echo that.

As others have pointed out, the above should work provided that you are 
terminating your curly braces properly.

Another (perhaps easier) option would be to use alternate syntax which is 
more similar to VBScript.  For example, the following works in PHP:

?if($varA === true):?
...html...
?else:?
...html...
?endif?

Note the colon's which are required.  The endif will need a semicolon if 
there are any other commands after it in the same code block.  Also, I 
don't believe you can mix alternate syntax and normal syntax in the same 
control structure.  For example, the following will probably give an error:

?
if (condition):
 if (other condition) {
 do stuff
 }
endif;
?

You'd have to use alternate syntax on the nested if statement as well...

I personally prefer alternate syntax when I'm breaking into and out of PHP 
a lot, like the example above.  For more info:

http://www.php.net/manual/en/control-structures.alternative-syntax.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/else conditional statement ... in an include file ...

2001-12-23 Thread Robert Dyke

I apologize for not including all of the information.  I did this as an
include file, which explains why it isn't working:

 !--- beginning of myinclude.php  

? If ($varA == True) {  ?

 ! --- end of myinclude.php --- 



 !  beginning of testfile.php --- 
?
Include('myinclude.php');
?
Html here that should display only if $varA  == True

 ?
}  // generic parser error generated here
Else {
?

HTML that only displays if $varA != True

?
}
?
 ! - End of testfile.php  


In ASP this works, in PHP it doesn't ... any ideas?


Michael Sims [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 At 01:11 PM 12/23/2001 -0700, Robert Dyke wrote:
 Hello:
 
 In ASP I can write a Conditional statement like this:
 
 % If $varA == True Then %
 Straight HTML in here that only displays if $varA == True
 % Else %
 Straight HTML in here that only displays if $varA != True
 % End if %
 
 Translating this to PHP doesn't work:
 
 ? If ($varA == True) {  ?   // error is generated here ...
 
 
 Is there some way to do it this way in PHP?  I'd rather not create a huge
 variable and then echo that.

 As others have pointed out, the above should work provided that you are
 terminating your curly braces properly.

 Another (perhaps easier) option would be to use alternate syntax which
is
 more similar to VBScript.  For example, the following works in PHP:

 ?if($varA === true):?
 ...html...
 ?else:?
 ...html...
 ?endif?

 Note the colon's which are required.  The endif will need a semicolon if
 there are any other commands after it in the same code block.  Also, I
 don't believe you can mix alternate syntax and normal syntax in the same
 control structure.  For example, the following will probably give an
error:

 ?
 if (condition):
  if (other condition) {
  do stuff
  }
 endif;
 ?

 You'd have to use alternate syntax on the nested if statement as well...

 I personally prefer alternate syntax when I'm breaking into and out of PHP
 a lot, like the example above.  For more info:

 http://www.php.net/manual/en/control-structures.alternative-syntax.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]




  1   2   >