[PHP] Re: Switch Statement

2013-09-28 Thread Jim Giner
On 9/28/2013 10:33 PM, Ethan Rosenberg wrote: Dear List - I have a working program. I made one change in a switch statement, and it does not work. I'm probably missing something fundamental. Here are some code SNIPPETS... [please note that all my debug statements are at the left margin]

[PHP] Re: Switch Statement

2013-09-28 Thread Jim Giner
?php session_start(); session_name(STORE); set_time_limit(2400); ini_set('display_errors', 'on'); ini_set('display_startup_errors', 'on'); error_reporting(-2); ini_set('error_reporting', 'E_ALL | E_STRICT'); ini_set('html_errors', 'On');

Re: [PHP] Re: Switch Statement

2013-09-28 Thread Ethan Rosenberg
On 09/28/2013 11:59 PM, Jim Giner wrote: ?php session_start(); session_name(STORE); set_time_limit(2400); ini_set('display_errors', 'on'); ini_set('display_startup_errors', 'on'); error_reporting(-2); ini_set('error_reporting', 'E_ALL | E_STRICT');

Re: [PHP] Re: Switch Statement

2013-09-28 Thread Jim Giner
On 9/29/2013 1:29 AM, Ethan Rosenberg wrote: On 09/28/2013 11:59 PM, Jim Giner wrote: ?php session_start(); session_name(STORE); set_time_limit(2400); ini_set('display_errors', 'on'); ini_set('display_startup_errors', 'on'); error_reporting(-2);

Re: [PHP] Re: Switch Statement

2013-09-28 Thread Jim Giner
On 9/29/2013 1:38 AM, Jim Giner wrote: session_start(); session_name(STORE); set_time_limit(2400); ini_set('display_errors', 'on'); ini_set('display_startup_errors', 'on'); error_reporting(-2); ini_set('error_reporting', 'E_ALL | E_STRICT');

RE: [PHP] Re: UNLESS Statement Equivalent

2013-03-12 Thread Ford, Mike
-Original Message- From: Maciek Sokolewicz [mailto:tula...@gmail.com] On Behalf Of Maciek Sokolewicz Sent: 11 March 2013 22:44 unless ( $a and $b ) = if ( ! ($a and $b) ) So in simple terms, just stick a ! (or the keyword not) in front of your expression, and you'll have

Re: [PHP] Re: UNLESS Statement Equivalent

2013-03-12 Thread Sebastian Krebs
2013/3/12 Ford, Mike m.f...@leedsmet.ac.uk -Original Message- From: Maciek Sokolewicz [mailto:tula...@gmail.com] On Behalf Of Maciek Sokolewicz Sent: 11 March 2013 22:44 unless ( $a and $b ) = if ( ! ($a and $b) ) So in simple terms, just stick a ! (or the keyword

RE: [PHP] Re: UNLESS Statement Equivalent

2013-03-12 Thread Arno Kuhl
-Original Message- From: Ford, Mike [mailto:m.f...@leedsmet.ac.uk] Sent: 12 March 2013 10:51 AM To: PHP General Subject: RE: [PHP] Re: UNLESS Statement Equivalent unless ( $a and $b ) = if ( ! ($a and $b) ) So in simple terms, just stick a ! (or the keyword not) in front of your

RE: [PHP] Re: UNLESS Statement Equivalent

2013-03-12 Thread Arno Kuhl
-Original Message- From: Ford, Mike [mailto:m.f...@leedsmet.ac.uk] Sent: 12 March 2013 10:51 AM To: PHP General Subject: RE: [PHP] Re: UNLESS Statement Equivalent unless ( $a and $b ) = if ( ! ($a and $b) ) So in simple terms, just stick a ! (or the keyword not) in front of your

RE: [PHP] Re: UNLESS Statement Equivalent

2013-03-12 Thread Ford, Mike
-Original Message- From: Arno Kuhl [mailto:a...@dotcontent.net] Sent: 12 March 2013 13:04 Mike, I presume you're saying the precedence of the Boolean keyword operators is lower than the Boolean symbol operators, but if so then wouldn't there be less need for the parentheses? I

[PHP] Re: UNLESS Statement Equivalent

2013-03-11 Thread Maciek Sokolewicz
On 11-3-2013 22:32, Angela Barone wrote: I'm looking for an 'unless' statement, but as far as I can tell, PHP doesn't have one. Hopefully someone can help me rewrite my statement. In English, I want to say: always do something UNLESS these 3 conditions are met. The

Re: [PHP] Switch - Case Statement Questions

2012-11-21 Thread Tedd Sperling
On Nov 19, 2012, at 2:46 PM, Stuart Dallas stu...@3ft9.com wrote: On 19 Nov 2012, at 19:35, Tim Streater t...@clothears.org.uk wrote: On 18 Nov 2012 at 14:44, Jim Giner jim.gi...@albanyhandball.com wrote: Just so. Perhaps those who are not grasping the point could re-read their copy of

[PHP] re:Switch - Case Statement Questions

2012-11-16 Thread Omar Muhsin
Hello, I was just wondering after writting the code in version 2 here below, it turns out in testing that it actually PHP is not validating the expressions instead always I get the first case. 1.Using nested if statement {THE INTENDED BEHAVIOR}: if ($count 14) $boxes = 3;

Re: [PHP] re:Switch - Case Statement Questions

2012-11-16 Thread Ken Robinson
At 07:10 AM 11/16/2012, Omar Muhsin wrote: Hello, I was just wondering after writting the code in version 2 here below, it turns out in testing that it actually PHP is not validating the expressions instead always I get the first case. 1.Using nested if statement {THE INTENDED BEHAVIOR}:

Re: [PHP] re:Switch - Case Statement Questions

2012-11-16 Thread Iñigo Medina
On Fri, 16 Nov 2012, Ken Robinson wrote: At 07:10 AM 11/16/2012, Omar Muhsin wrote: Hello, I was just wondering after writting the code in version 2 here below, it turns out in testing that it actually PHP is not validating the expressions instead always I get the first case. 1.Using

Re: [PHP] mysql case statement

2010-06-28 Thread Andrew Ballard
On Sun, Jun 27, 2010 at 4:08 AM, Tanel Tammik keevit...@gmail.com wrote: Hello, how to select only if value is present?    $query = $db-query(select menus.id, menus.name,      case        when panels.id is not null then '1'        end as hiddenpanel    from . \DB_MENUS . as menus      

Re: [PHP] mysql case statement

2010-06-28 Thread David McGlone
On Monday 28 June 2010 09:49:55 Andrew Ballard wrote: On Sun, Jun 27, 2010 at 4:08 AM, Tanel Tammik keevit...@gmail.com wrote: Hello, how to select only if value is present? $query = $db-query(select menus.id, menus.name, case when panels.id is not null then '1'

Re: [PHP] mysql case statement

2010-06-28 Thread David McGlone
On Sunday 27 June 2010 22:12:41 Brandon Rampersad wrote: no At least smack me and give us an explanation. :-) -- Blessings, David M. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] mysql case statement

2010-06-28 Thread Andrew Ballard
On Mon, Jun 28, 2010 at 10:27 AM, David McGlone da...@dmcentral.net wrote: Tanel, we both learned something. I didn't fully understand join myself yet, but I think I do now. but let me ask this if the join wasn't there would an if statement like I mentioned have worked? Blessings, David M.

Re: [PHP] mysql case statement

2010-06-28 Thread David McGlone
On Monday 28 June 2010 11:14:53 Andrew Ballard wrote: On Mon, Jun 28, 2010 at 10:27 AM, David McGlone da...@dmcentral.net wrote: Tanel, we both learned something. I didn't fully understand join myself yet, but I think I do now. but let me ask this if the join wasn't there would an if

Re: [PHP] mysql case statement

2010-06-27 Thread David McGlone
On Sunday 27 June 2010 04:08:24 Tanel Tammik wrote: Hello, how to select only if value is present? $query = $db-query(select menus.id, menus.name, case when panels.id is not null then '1' end as hiddenpanel from . \DB_MENUS . as menus left join

Re: [PHP] mysql case statement

2010-06-27 Thread Brandon Rampersad
no On Sun, Jun 27, 2010 at 8:29 PM, David McGlone da...@dmcentral.net wrote: On Sunday 27 June 2010 04:08:24 Tanel Tammik wrote: Hello, how to select only if value is present? $query = $db-query(select menus.id, menus.name, case when panels.id is not null then

[PHP] complex if statement for field validation

2010-06-07 Thread David Mehler
Hello, I've got a form with three fields that are not required for proper completion of it, ending month, day, year fields. If a user enters nothing no problem, but if those form fields are entered I need them validated. They have to be in the correct format -MM-DD date format and that value

Re: [PHP] complex if statement for field validation

2010-06-07 Thread Ashley Sheridan
On Mon, 2010-06-07 at 16:51 -0400, David Mehler wrote: Hello, I've got a form with three fields that are not required for proper completion of it, ending month, day, year fields. If a user enters nothing no problem, but if those form fields are entered I need them validated. They have to be

Re: [PHP] complex if statement for field validation

2010-06-07 Thread Jim Lucas
David Mehler wrote: Hello, I've got a form with three fields that are not required for proper completion of it, ending month, day, year fields. If a user enters nothing no problem, but if those form fields are entered I need them validated. They have to be in the correct format -MM-DD

Re: [PHP] Basic switch statement

2010-04-16 Thread Jan G.B.
2010/4/16 Adam Richardson simples...@gmail.com: On Thu, Apr 15, 2010 at 5:55 PM, Jason Pruim li...@pruimphotography.comwrote: On Apr 15, 2010, at 8:55 AM, tedd wrote:  At 4:13 PM -0400 4/14/10, Al wrote: Incidentally, about formatting scripts, one of the reasons I like phpEdit is that

Re: [PHP] Basic switch statement

2010-04-16 Thread Robert Cummings
Jan G.B. wrote: 2010/4/16 Adam Richardson simples...@gmail.com: On Thu, Apr 15, 2010 at 5:55 PM, Jason Pruim li...@pruimphotography.comwrote: On Apr 15, 2010, at 8:55 AM, tedd wrote: At 4:13 PM -0400 4/14/10, Al wrote: Incidentally, about formatting scripts, one of the reasons I like

Re: [PHP] Basic switch statement

2010-04-16 Thread tedd
At 9:06 AM -0400 4/16/10, Robert Cummings wrote: It runs in a terminal! Cheers, Rob. That's not good. Airport security frowns on that. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Basic switch statement

2010-04-16 Thread Jim Lucas
tedd wrote: At 9:06 AM -0400 4/16/10, Robert Cummings wrote: It runs in a terminal! Cheers, Rob. That's not good. Airport security frowns on that. Cheers, tedd Mac users might get a little upset if Airport security doesn't allow them to use their terminals to run -- Jim Lucas

Re: [PHP] Basic switch statement

2010-04-15 Thread tedd
At 4:13 PM -0400 4/14/10, Al wrote: Incidentally, about formatting scripts, one of the reasons I like phpEdit is that it has a terrific code beautifier. You can set it for phpDoc or Pear rendering. And, it auto indents, etc. as you enter stuff. Al... Unfortunately, there is no

Re: [PHP] Basic switch statement

2010-04-15 Thread Bastien Koert
On Thu, Apr 15, 2010 at 8:55 AM, tedd tedd.sperl...@gmail.com wrote: At 4:13 PM -0400 4/14/10, Al wrote: Incidentally, about formatting scripts, one of the reasons I like phpEdit is that it has a terrific code beautifier.  You can set it for phpDoc or Pear rendering. And, it auto indents,

Re: [PHP] Basic switch statement

2010-04-15 Thread Ashley Sheridan
On Thu, 2010-04-15 at 08:55 -0400, tedd wrote: At 4:13 PM -0400 4/14/10, Al wrote: Incidentally, about formatting scripts, one of the reasons I like phpEdit is that it has a terrific code beautifier. You can set it for phpDoc or Pear rendering. And, it auto indents, etc. as you enter

Re: [PHP] Basic switch statement

2010-04-15 Thread Jason Pruim
On Apr 15, 2010, at 8:55 AM, tedd wrote: At 4:13 PM -0400 4/14/10, Al wrote: Incidentally, about formatting scripts, one of the reasons I like phpEdit is that it has a terrific code beautifier. You can set it for phpDoc or Pear rendering. And, it auto indents, etc. as you enter stuff.

Re: [PHP] Basic switch statement

2010-04-15 Thread Jason Pruim
On Apr 15, 2010, at 9:24 AM, Ashley Sheridan wrote: On Thu, 2010-04-15 at 08:55 -0400, tedd wrote: Have you tried Coder on the Mac? Most developers I know who use Macs (it's not the oxymoron it sounds! :p ) Most Mac people would say the morons use Windows ;) But that's another story

Re: [PHP] Basic switch statement

2010-04-15 Thread Adam Richardson
On Thu, Apr 15, 2010 at 5:55 PM, Jason Pruim li...@pruimphotography.comwrote: On Apr 15, 2010, at 8:55 AM, tedd wrote: At 4:13 PM -0400 4/14/10, Al wrote: Incidentally, about formatting scripts, one of the reasons I like phpEdit is that it has a terrific code beautifier. You can set it

Re: [PHP] Basic switch statement

2010-04-14 Thread tedd
At 10:04 PM +0100 4/13/10, Nathan Rixham wrote: Robert Cummings wrote: Nathan Rixham wrote: Fail on that last one. -1 is not equivalent to FALSE :B well that's one job I'm not getting :p cheers for the picking that one up Rob And that's the reason why I hate test like that! The short

Re: [PHP] Basic switch statement

2010-04-14 Thread tedd
At 5:06 PM -0400 4/13/10, Robert Cummings wrote: Nathan Rixham wrote: well that's one job I'm not getting :p Well you DID get 66.7%. I've met coders that would stare at the answer and still not understand :D Cheers, Rob. Well.. count me among those staring. I just don't get those type

Re: [PHP] Basic switch statement

2010-04-14 Thread Robert Cummings
tedd wrote: At 5:06 PM -0400 4/13/10, Robert Cummings wrote: Nathan Rixham wrote: well that's one job I'm not getting :p Well you DID get 66.7%. I've met coders that would stare at the answer and still not understand :D Cheers, Rob. Well.. count me among those staring. I just don't get

[PHP] Basic switch statement

2010-04-13 Thread steve_r
I'm new to programming, drive a truck in the day, now taking night courses to get a better job for my family. Please bear with me if this is a dumb question, I don't have much experience. I'm taking a night class in HTML and PHP and can't figure out a problem and can't find the answer in the

Re: [PHP] Basic switch statement

2010-04-13 Thread Ashley Sheridan
On Tue, 2010-04-13 at 12:04 -0400, steve_r wrote: I'm new to programming, drive a truck in the day, now taking night courses to get a better job for my family. Please bear with me if this is a dumb question, I don't have much experience. I'm taking a night class in HTML and PHP and can't

Re: [PHP] Basic switch statement

2010-04-13 Thread Robert Cummings
steve_r wrote: I'm new to programming, drive a truck in the day, now taking night courses to get a better job for my family. Please bear with me if this is a dumb question, I don't have much experience. I'm taking a night class in HTML and PHP and can't figure out a problem and can't find the

Re: [PHP] Basic switch statement

2010-04-13 Thread steve_r
Okay, I understand now, true/false is better, now it makes sense why it's always hitting the case it hits. Thank you Ashley.

Re: [PHP] Basic switch statement

2010-04-13 Thread tedd
At 12:04 PM -0400 4/13/10, steve_r wrote: I'm new to programming, drive a truck in the day, now taking night courses to get a better job for my family. Please bear with me if this is a dumb question, I don't have much experience. -snip- Sorry for the basic question. Steve Reilly Steve:

Re: [PHP] Basic switch statement

2010-04-13 Thread Nathan Rixham
Robert Cummings wrote: steve_r wrote: I'm new to programming, drive a truck in the day, now taking night courses to get a better job for my family. Please bear with me if this is a dumb question, I don't have much experience. I'm taking a night class in HTML and PHP and can't figure out a

Re: [PHP] Basic switch statement

2010-04-13 Thread Robert Cummings
Nathan Rixham wrote: Robert Cummings wrote: steve_r wrote: I'm new to programming, drive a truck in the day, now taking night courses to get a better job for my family. Please bear with me if this is a dumb question, I don't have much experience. I'm taking a night class in HTML and PHP and

Re: [PHP] Basic switch statement

2010-04-13 Thread Nathan Rixham
Robert Cummings wrote: Nathan Rixham wrote: Robert Cummings wrote: steve_r wrote: I'm new to programming, drive a truck in the day, now taking night courses to get a better job for my family. Please bear with me if this is a dumb question, I don't have much experience. I'm taking a

Re: [PHP] Basic switch statement

2010-04-13 Thread Robert Cummings
Nathan Rixham wrote: Robert Cummings wrote: Nathan Rixham wrote: Robert Cummings wrote: steve_r wrote: I'm new to programming, drive a truck in the day, now taking night courses to get a better job for my family. Please bear with me if this is a dumb question, I don't have much experience.

Re: [PHP] Basic switch statement

2010-04-13 Thread Nathan Rixham
Robert Cummings wrote: Nathan Rixham wrote: Robert Cummings wrote: Nathan Rixham wrote: Robert Cummings wrote: steve_r wrote: I'm new to programming function check_it2($val) { echo gettype($val); switch($val) { case($val 0 ): echo Switch greater than 0;

Re: [PHP] Basic switch statement

2010-04-13 Thread Robert Cummings
Nathan Rixham wrote: Robert Cummings wrote: Nathan Rixham wrote: Robert Cummings wrote: Nathan Rixham wrote: Robert Cummings wrote: steve_r wrote: I'm new to programming function check_it2($val) { echo gettype($val); switch($val) { case($val 0 ): echo Switch

Re: [PHP] Basic switch statement

2010-04-13 Thread Nathan Rixham
Robert Cummings wrote: Nathan Rixham wrote: Robert Cummings wrote: Nathan Rixham wrote: Robert Cummings wrote: Nathan Rixham wrote: Robert Cummings wrote: steve_r wrote: I'm new to programming function check_it2($val) { echo gettype($val); switch($val) { case($val 0

[PHP] help with statement

2009-04-15 Thread Terion Miller
I'm trying to take a paragraph then break it into linebreaks and grab each line separately but it's not working, I can get the paragraph but my lines are not I get the object id #6 or #7 everytime Here's my code // grab all the paragraphs on the page $xpath = new DOMXPath($dom); //$graphs =

[PHP] long echo statement performance question

2009-02-06 Thread Frank Stanovcak
I'm in the process of seperating logic from display in a section of code, and wanted to make sure I wasn't treading on a performance landmine here, so I ask you wizened masters of the dark arts this... is there a serious performance hit, or reason not to use long, ie more than 30 - 40 lines,

Re: [PHP] long echo statement performance question

2009-02-06 Thread Richard Heyes
... Wouldn't have thought so. But for readability, you may find this a little easier instead: ? {$var1} Blah {$var2} ... ?php -- Richard Heyes HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.org (Updated January 31st) -- PHP General Mailing List

Re: [PHP] long echo statement performance question

2009-02-06 Thread Bruno Fajardo
In my opinion, you would achieve better results using a template engine, like Smarty (http://www.smarty.net/). In addition, your code would be entirely separated from presentation in a elegant way. 2009/2/6 Frank Stanovcak blindspot...@comcast.net: I'm in the process of seperating logic from

Re: [PHP] long echo statement performance question

2009-02-06 Thread Richard Heyes
Wouldn't have thought so. But for readability, you may find this a little easier instead: Slight correction: ? ?=$var1? blah ?=var2? ?php -- Richard Heyes HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.org (Updated January 31st) -- PHP General Mailing

Re: [PHP] long echo statement performance question

2009-02-06 Thread Frank Stanovcak
Richard Heyes rich...@php.net wrote in message news:af8726440902060918v6d2f1ee1ia3f839189874...@mail.gmail.com... Wouldn't have thought so. But for readability, you may find this a little easier instead: Slight correction: ? ?=$var1? blah ?=var2? ?php -- Richard Heyes HTML5

Re: [PHP] long echo statement performance question

2009-02-06 Thread Frank Stanovcak
Bruno Fajardo bsfaja...@gmail.com wrote in message news:eeb6980b0902060915k2b34ec31nc6ad166e2c544...@mail.gmail.com... In my opinion, you would achieve better results using a template engine, like Smarty (http://www.smarty.net/). In addition, your code would be entirely separated from

Re: [PHP] long echo statement performance question

2009-02-06 Thread Stuart
2009/2/6 Frank Stanovcak blindspot...@comcast.net: Richard Heyes rich...@php.net wrote in message news:af8726440902060918v6d2f1ee1ia3f839189874...@mail.gmail.com... Wouldn't have thought so. But for readability, you may find this a little easier instead: Slight correction: ? ?=$var1?

Re: [PHP] long echo statement performance question

2009-02-06 Thread Eric Butera
On Fri, Feb 6, 2009 at 12:15 PM, Bruno Fajardo bsfaja...@gmail.com wrote: In my opinion, you would achieve better results using a template engine, like Smarty (http://www.smarty.net/). In addition, your code would be entirely separated from presentation in a elegant way. 2009/2/6 Frank

Re: [PHP] long echo statement performance question

2009-02-06 Thread Bruno Fajardo
Well, Smarty's caching layer is very fast. Maybe not as fast as an echo statement, but apparentely Frank was also interested in separate logic from presentation, and a series of echo's is not the best solution in my opinion. :-) But the best solution depends of the context of the application, i

Re: [PHP] long echo statement performance question

2009-02-06 Thread Eric Butera
On Fri, Feb 6, 2009 at 1:43 PM, Bruno Fajardo bsfaja...@gmail.com wrote: Well, Smarty's caching layer is very fast. Maybe not as fast as an echo statement, but apparentely Frank was also interested in separate logic from presentation, and a series of echo's is not the best solution in my

Re: [PHP] long echo statement performance question

2009-02-06 Thread Bruno Fajardo
I am so stick to Smarty that I never tried other solutions, like Savant. Thanks for the tip, I'll try it right away. Cheers. 2009/2/6 Eric Butera eric.but...@gmail.com: On Fri, Feb 6, 2009 at 1:43 PM, Bruno Fajardo bsfaja...@gmail.com wrote: Well, Smarty's caching layer is very fast. Maybe not

Re: [PHP] long echo statement performance question

2009-02-06 Thread Eric Butera
On Fri, Feb 6, 2009 at 2:10 PM, Bruno Fajardo bsfaja...@gmail.com wrote: I am so stick to Smarty that I never tried other solutions, like Savant. Thanks for the tip, I'll try it right away. Cheers. 2009/2/6 Eric Butera eric.but...@gmail.com: On Fri, Feb 6, 2009 at 1:43 PM, Bruno Fajardo

Re: [PHP] long echo statement performance question

2009-02-06 Thread Paul M Foster
On Fri, Feb 06, 2009 at 01:09:13PM -0500, Eric Butera wrote: On Fri, Feb 6, 2009 at 12:15 PM, Bruno Fajardo bsfaja...@gmail.com wrote: In my opinion, you would achieve better results using a template engine, like Smarty (http://www.smarty.net/). In addition, your code would be entirely

Re: [PHP] long echo statement performance question

2009-02-06 Thread Frank Stanovcak
Stuart stut...@gmail.com wrote in message news:a5f019de0902060932k1ccf2948ua42f3cfa33694...@mail.gmail.com... 2009/2/6 Frank Stanovcak blindspot...@comcast.net: Richard Heyes rich...@php.net wrote in message news:af8726440902060918v6d2f1ee1ia3f839189874...@mail.gmail.com... Wouldn't have

Re: [PHP] long echo statement performance question

2009-02-06 Thread Daevid Vincent
On Fri, 2009-02-06 at 17:32 +, Stuart wrote: They're called short tags, not fast tags. There is nothing faster about them beyond the typing effort required. Mostly true. However, the only thing that ?= ? does is an echo/print, so aside from saving you ?php echo $foo; ? all the time, you

Re: [PHP] long echo statement performance question

2009-02-06 Thread Sancar Saran
On Friday 06 February 2009 19:12:08 Frank Stanovcak wrote: I'm in the process of seperating logic from display in a section of code, and wanted to make sure I wasn't treading on a performance landmine here, so I ask you wizened masters of the dark arts this... is there a serious performance

Re: [PHP] long echo statement performance question

2009-02-06 Thread Stephen
I have been reading this thread with interest ... and amusement. FWII for my web sites I have 1) Most PHP code in files outside of the document root 2) Site specific variables (constants, really) in an include.php file 3) All HTML is also in this include file and is the content a variable. 4)

Re: [PHP] Re: Switch statement Question

2009-02-02 Thread Frank Stanovcak
tedd tedd.sperl...@gmail.com wrote in message news:p06240801c5aa0ed7d...@[192.168.1.101]... At 4:16 PM +0100 1/30/09, Jochem Maas wrote: tedd schreef: At 4:43 PM -0500 1/29/09, Frank Stanovcak wrote: yes...that is legal. as long as the statment resolves to a boolean it will work.

Re: [PHP] Re: Switch statement Question

2009-01-31 Thread tedd
At 4:16 PM +0100 1/30/09, Jochem Maas wrote: tedd schreef: At 4:43 PM -0500 1/29/09, Frank Stanovcak wrote: yes...that is legal. as long as the statment resolves to a boolean it will work. It's not technically correct, but it does work. There you go again. What's technically

[PHP] Re: Switch statement Question

2009-01-30 Thread tedd
At 4:43 PM -0500 1/29/09, Frank Stanovcak wrote: yes...that is legal. as long as the statment resolves to a boolean it will work. It's not technically correct, but it does work. There you go again. What's technically correct? Cheers, tedd -- --- http://sperling.com

Re: [PHP] Re: Switch statement Question

2009-01-30 Thread Jochem Maas
tedd schreef: At 4:43 PM -0500 1/29/09, Frank Stanovcak wrote: yes...that is legal. as long as the statment resolves to a boolean it will work. It's not technically correct, but it does work. There you go again. What's technically correct? hiya tedd, you mean to ask not technically

[PHP] Re: Switch statement Question

2009-01-29 Thread Frank Stanovcak
Alice Wei aj...@alumni.iu.edu wrote in message news:snt101-w587cd616331fc59b84834af0...@phx.gbl... Hi, I have a code snippet here as in the following: //Switch statements between the four options switch($string) { case : $string= NOT book.author='All'; break; default: $string= $string . AND

[PHP] Cannot create statement handler

2008-11-17 Thread Thodoris
I was wondering if anyone sees something I am bypassing: I have this sample code that works in another server: ?php function getClientFullName($dbh,$id){ // die(var_dump($dbh)); $sql = SELECT * FROM Clients WHERE Id=.$id; // die(print $sql); $sthr = $dbh-query($sql); //

[PHP] Newbie select statement questions 'WHERE'

2008-04-23 Thread revDAVE
NEWBIE! I have some GET data coming from a previous search form. How do I add the WHERE part ? orig: $query_get1 = SELECT p_First, p_id, p_Last, p_Lvl, p_Sel FROM contacts; --W / WHERE...??? $query_get1 = SELECT p_First, p_id, p_Last, p_Lvl, p_Sel FROM contacts WHERE p_First like

Re: [PHP] Newbie select statement questions 'WHERE'

2008-04-23 Thread Robert Cummings
On Wed, 2008-04-23 at 19:07 -0700, revDAVE wrote: NEWBIE! I have some GET data coming from a previous search form. How do I add the WHERE part ? orig: $query_get1 = SELECT p_First, p_id, p_Last, p_Lvl, p_Sel FROM contacts; --W / WHERE...??? $query_get1 = SELECT p_First, p_id,

Re: [PHP] Newbie ' If Statement' Question

2008-03-16 Thread [EMAIL PROTECTED]
Thank you everybody for these great tips! -- Thanks - RevDave Cool7 @ hosting4days . com [db-lists] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Newbie ' If Statement' Question

2008-03-14 Thread [EMAIL PROTECTED]
Hello Folks, I would like to be able to wrap a 'form' inside a php 'if statement' - so that the form will appear if the 'if condition' is met. - most likely I cannot have a ?php tag inside another one - and am sure I'm doing other things wrong also... - now I get the error - Parse error

Re: [PHP] Newbie ' If Statement' Question

2008-03-14 Thread Nathan Nobbe
On Fri, Mar 14, 2008 at 7:56 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello Folks, I would like to be able to wrap a 'form' inside a php 'if statement' - so that the form will appear if the 'if condition' is met. - most likely I cannot have a ?php tag inside another one - and am

Re: [PHP] Newbie ' If Statement' Question

2008-03-14 Thread Benjamin Darwin
On Fri, Mar 14, 2008 at 7:56 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello Folks, I would like to be able to wrap a 'form' inside a php 'if statement' - so that the form will appear if the 'if condition' is met. - most likely I cannot have a ?php tag inside another one - and am

Re: [PHP] Re: If statement duplicating mysql records?

2007-06-20 Thread Jason Pruim
On Jun 19, 2007, at 5:10 PM, Roberto Mansfield wrote: Jason Pruim wrote: Okay, so I have a question... Probably pretty easy, but why would my if statement show more records then what are in the database? if($row[5] =='Level4'){ // White Highlight }// End of Level 4 else

[PHP] Re: If statement duplicating mysql records?

2007-06-19 Thread Roberto Mansfield
Jason Pruim wrote: Okay, so I have a question... Probably pretty easy, but why would my if statement show more records then what are in the database? if($row[5] =='Level4'){ // White Highlight }// End of Level 4 else {// Green Highlight }// End of

Re: [PHP] Nested foreach statement

2006-08-03 Thread Richard Lynch
It will probably work, and you could find out for sure by just trying it. It might be better to construct a single query using things like: $company_ids = implode(', ', $_POST['reporton_company']); $query .= WHERE company_id IN ($company_ids) ; This presumes you have already validated the

[PHP] Nested foreach statement

2006-07-31 Thread Chris Grigor
Have been wondering if this is possible Basically I have 3 posted arrays, $_POST['reporton_company'] (this can be various company id's. ie 3,6,7) $_POST['report_period'] (this can be various periods but a max of 4 submitted. ie 3,4,5) $_POST['questions_groups'] (this can be various -

Re: [PHP] Nested foreach statement

2006-07-31 Thread chris smith
foreach($_POST['reporton_company'] as $cmp_ind =$arrayd_cmp_id) { foreach($_POST['report_period'] as $rep_ind =$arrayd_per_id) { foreach($_POST['questions_groups'] as $group_ind = $arrayd_group_no) { mysql_select_db($database_name, $dname); Why

[PHP] Re: If statement question

2006-06-26 Thread Adam Zey
Alex Major wrote: Hi list. Basically, I'm still learning new things about php and I was wondering if things inside an if statement get 'looked at' by a script if the condition is false. For example, would this mysql query get executed if $number = 0 ? If ($number == 1) { mysql_query($blah)

[PHP] mysql select statement in php having three conditions

2005-12-16 Thread sunaram patir
hi, can someone tell me how to do this: i have to retrive data from a mysql table let's sayTABLE . i have to check that the rows i retrive meet this condition: field1='$variable',field2 is false and field3 is also false. as you can see field2 and field3 are bool type. field1 is varchar. i did

RE: [PHP] mysql select statement in php having three conditions

2005-12-16 Thread Jay Blanchard
[snip] can someone tell me how to do this: i have to retrive data from a mysql table let's sayTABLE . i have to check that the rows i retrive meet this condition: field1='$variable',field2 is false and field3 is also false. as you can see field2 and field3 are bool type. field1 is varchar. i

[PHP] Unnecessary if statement? Programming technique

2005-12-06 Thread Steve McGill
Hi everyone Quick question: If I have such a loop: ? for($i=0;$i100;$i++) { if($i==100) { // do something special for this occurence } // do something standard } ? In this case it seems such a waste that the if() statement is done 99 times when it's not needed. Is there any

RE: [PHP] Unnecessary if statement? Programming technique

2005-12-06 Thread Jared Williams
To: php-general@lists.php.net Subject: [PHP] Unnecessary if statement? Programming technique Hi everyone Quick question: If I have such a loop: ? for($i=0;$i100;$i++) { if($i==100) { } // do something standard } ? In this case it seems such a waste

Re: [PHP] Unnecessary if statement? Programming technique

2005-12-06 Thread David Grant
Jared Williams wrote: Why not for ($i = 0; $i 100/100; ++$i) This involves dividing 100 by 100 for each iteration of the loop. It would be better to test against 1. There is also the unwanted side-effect of executing the code on each hundredth iteration, which is unwanted (as

Re: [PHP] Unnecessary if statement? Programming technique

2005-12-06 Thread Steve McGill
Hi, David is right about the unwanted side-effect. Thanks for the idea though. Unfortunately the 'greater problem' is not so great, I've just been doing this for a while now and find myself programming loops like these so often and I've never got round to testing if a simple IF statement is a

Re: [PHP] Unnecessary if statement? Programming technique

2005-12-06 Thread David Grant
Hi, I imagine this kind of thing is not especially taxing on the processor, especially if the condition is a fairly simple comparison. That said, I have very little understanding aside from my own limited experience of what runs slowly! If you're worried about code maintenance, then move the

Re: [PHP] Unnecessary if statement? Programming technique

2005-12-06 Thread tg-php
This is probably going to sound strange, but I like to try to think outside the box (buzzphrase!) and hit things at odd angles. Would someone care to test (or already know) the performance difference between a for loop and a foreach loop? Or the performance difference over many iterations of

RE: [PHP] Single SQL-statement in PHP to order...

2005-04-19 Thread Jared Williams
Hi there! I guess this is off-topic? but I want to know if this is possible. (If there's anyone out there that have a solution, I would appreciate it though) I want to know if there is anyway of showing tables in PHP in an order like this in a single SQL-statement...

[PHP] Single SQL-statement in PHP to order...

2005-04-18 Thread Gustav Wiberg
Hi there! I guess this is off-topic? but I want to know if this is possible. (If there's anyone out there that have a solution, I would appreciate it though) I want to know if there is anyway of showing tables in PHP in an order like this in a single SQL-statement... Table is like this:

Re: [PHP] Single SQL-statement in PHP to order...

2005-04-18 Thread Richard Lynch
select ... from ... ORDER BY (IDCategory = 4) DESC, IDCategory = 4 will return 1 or 0, for 4 or not 4. 1 is bigger than 0, in most countries. :-) On Mon, April 18, 2005 2:50 pm, Gustav Wiberg said: Hi there! I guess this is off-topic? but I want to know if this is possible. (If there's

[PHP] Re: SQL statement - date

2005-04-06 Thread kyriacos sakkas
Jacques wrote: How should I formulate my sql statement to create a result set of members who registered between now and 7 days ago? I have tried the following and it is obviously incorrect: $sqlnewmembers = Select uid, uprofilename from tblusers where udatereg between (date() and date()

[PHP] Re: SQL statement - please help

2005-03-24 Thread Jason Barnett
Try a MySQL list. Or possibly even php-db. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY |

Re: [PHP] in_array w/statement

2004-12-16 Thread Matt M.
reason it seems to always be true, ... something i'm doing wrong? btw, i cannot add the in_array to the statement because if the $buddylist is empty it will generate errors because of the empty implode. you could add the is_array() check. $buddylist = preg_split('/( )+/',

  1   2   >