RE: [PHP] control structure

2011-08-04 Thread admin
-Original Message- From: Chris Stinemetz [mailto:chrisstinem...@gmail.com] Sent: Thursday, August 04, 2011 11:34 PM To: PHP General Subject: [PHP] control structure I have a php script with a simple condition. If it is not satisfied I want to exit the script otherwise I want

Re: [PHP] control structure

2011-08-04 Thread Chris Stinemetz
       // This part makes no sense they are not logged in and they have a level of 1 or 2 ? Yes. It might not be the best approach, but I am assigning the user a value: 1, 2, or 3 while they create an account. This will limit what they will be able to post. For example I only want users with

Re: [PHP] PHP control structure

2011-07-14 Thread Richard Quadling
On 14 July 2011 05:15, Negin Nickparsa nickpa...@gmail.com wrote: if the problem is only the assigning it's an example: in mysql you can have this one: create table store_list(id_markets int auto_increment,store_type int,primary key(id_markets)); and for page this one: html head

Re: [PHP] PHP control structure

2011-07-13 Thread Tamara Temple
On Jul 12, 2011, at 10:11 PM, Chris Stinemetz wrote: Hey all, I would like to add an if statement to the following function so that the value 1 is assigned corporate and the value is 2 assign standard to it. Would you show me an example on adding it to the below function? If there is a

Re: [PHP] PHP control structure

2011-07-13 Thread Negin Nickparsa
if the problem is only the assigning it's an example: in mysql you can have this one: create table store_list(id_markets int auto_increment,store_type int,primary key(id_markets)); and for page this one: html head titleStore/title /head form method=post ?php

[PHP] PHP control structure

2011-07-12 Thread Chris Stinemetz
Hey all, I would like to add an if statement to the following function so that the value 1 is assigned corporate and the value is 2 assign standard to it. Would you show me an example on adding it to the below function? If there is a better way to reassign the value please share. Thank you,

[PHP] Control structure - easier way than repeating conditions in IF?

2004-04-30 Thread BOOT
Hello! Can anyone tell me if there is an easier/shorthand for: if (($x == $a) || ($x == $b) || ($x == $c) || ($x == $d) ... ) {;} I understand the logic of why the following does not work: if ($x == ($a || $b || $c || $d)) {;} Thanks! -- PHP General Mailing List

RE: [PHP] Control structure - easier way than repeating conditions in IF?

2004-04-30 Thread Gryffyn, Trevor
easier to read I guess. -TG -Original Message- From: BOOT [mailto:[EMAIL PROTECTED] Sent: Friday, April 30, 2004 11:49 AM To: [EMAIL PROTECTED] Subject: [PHP] Control structure - easier way than repeating conditions in IF? Hello! Can anyone tell me if there is an easier

Re: [PHP] Control structure - easier way than repeating conditions in IF?

2004-04-30 Thread Neil Freeman
Why not just use a switch?... switch ($x) { case $a: case $b: case $c: case $d: //do whatever you need break; default: //catch any other values here break; } Neil BOOT wrote:

Re: [PHP] Control Structure Syntax Question

2004-03-10 Thread Michal Migurski
$x ? xxx : xxx But it makes your code less readable IMHO and offers no tangible benefit whatsoever. It offers the tangible benefit of evaluating to something: return (isset($foo) ? $foo : $bar); $query = select * from foo .(isset($bar) ? where bar = ${bar} :

[PHP] Control Structure Syntax Question

2004-03-09 Thread Ahbaid Gaffoor
Someone had posted a tip for using an abbreviated form of an if.. else structure... It looked something like: $x : action1 : action2; I'm trying to shorten having to do the following: if ($x) { action1; } else { action 2; } can someone please post the syntax if they know it? I am reading

Re: [PHP] Control Structure Syntax Question

2004-03-09 Thread daniel
$x ? action1 : action2; structure... It looked something like: $x : action1 : action2; I'm trying to shorten having to do the following: if ($x) { action1; } else { action 2; } can someone please post the syntax if they know it? I am reading the fine documentation but can't

Re: [PHP] Control Structure Syntax Question

2004-03-09 Thread Richard Davey
Hello Ahbaid, Tuesday, March 9, 2004, 11:42:21 PM, you wrote: AG Someone had posted a tip for using an abbreviated form of an if.. else AG structure... AG It looked something like: AG $x : action1 : action2; $x ? xxx : xxx But it makes your code less readable IMHO and offers no tangible

Re: [PHP] Control Structure Syntax Question

2004-03-09 Thread Ahbaid Gaffoor
Yeah, but if my code is less readable, my job security goes up ;) (Kidding) Thanks for all your help folks, that's what I needed. regards Ahbaid Richard Davey wrote: Hello Ahbaid, Tuesday, March 9, 2004, 11:42:21 PM, you wrote: AG Someone had posted a tip for using an abbreviated form of

Re: [PHP] Control Structure Syntax Question

2004-03-09 Thread Justin Patrin
Ahbaid Gaffoor wrote: Yeah, but if my code is less readable, my job security goes up ;) (Kidding) Thanks for all your help folks, that's what I needed. regards Ahbaid Richard Davey wrote: Hello Ahbaid, Tuesday, March 9, 2004, 11:42:21 PM, you wrote: AG Someone had posted a tip for using

Re: [PHP] Control Structure Syntax Question

2004-03-09 Thread trlists
On 9 Mar 2004 Richard Davey wrote: $x ? xxx : xxx But it makes your code less readable IMHO and offers no tangible benefit whatsoever. Ah, to each his/her own I guess ... I actually find: $value = ($condition ? $val1 : $val2); easier to read than: if ($condition)

Re: [PHP] Control Structure problem

2003-09-17 Thread David Robley
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... yeah, i really like using cases they work well and especially if you want to do something different for different values, i forgot about that, its a good way to do it, does php have case else? cuz that is a really handy thing in VB

RE: [PHP] Control Structure problem

2003-09-16 Thread Jennifer Goodie
This doesnt work as expected. if ( $var === TEST ONE || TEST TWO || TEST THREE) { do something; } It returns true on all strings. Ive tried using the or operator and the == but these fail as well. Any Ideas? It behaves exactly as expected. Try checking the manual section on

Re: [PHP] Control Structure problem

2003-09-16 Thread Luke Skywalker
try if ( $var == TEST ONE || $var == TEST TWO || $var == TEST THREE) { do something; } luke - Original Message - From: Dan J. Rychlik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 9:53 AM Subject: [PHP] Control Structure problem This doesnt work

Re: [PHP] Control Structure problem

2003-09-16 Thread Dan J. Rychlik
Structure problem try if ( $var == TEST ONE || $var == TEST TWO || $var == TEST THREE) { do something; } luke - Original Message - From: Dan J. Rychlik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 9:53 AM Subject: [PHP] Control Structure

[PHP] Control Structure problem

2003-09-16 Thread Dan J. Rychlik
This doesnt work as expected. if ( $var === TEST ONE || TEST TWO || TEST THREE) { do something; } It returns true on all strings. Ive tried using the or operator and the == but these fail as well. Any Ideas? -Dan

Re: [PHP] Control Structure problem

2003-09-16 Thread Luke Skywalker
: Wednesday, September 17, 2003 10:12 AM Subject: Re: [PHP] Control Structure problem Thank you guys. I truly know the level of expertise on this mailing list, and I know that it proves invaluable. Thank you again. -Dan - Original Message - From: Luke Skywalker [EMAIL PROTECTED

RE: [PHP] Control Structure problem

2003-09-16 Thread Chris W. Parker
Dan J. Rychlik mailto:[EMAIL PROTECTED] on Tuesday, September 16, 2003 5:12 PM said: Thank you guys. I truly know the level of expertise on this mailing list, and I know that it proves invaluable. lovingjab If by I truly know the level of expertise on this mailing list you meant I truly

Re: [PHP] Control Structure problem

2003-09-16 Thread Luke Skywalker
:) but i know it would be really nice in simple logical expressions Luke - Original Message - From: Chris W. Parker [EMAIL PROTECTED] To: Dan J. Rychlik [EMAIL PROTECTED]; Luke Skywalker [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 10:18 AM Subject: RE: [PHP] Control

Re: [PHP] Control Structure problem

2003-09-16 Thread Curt Zirzow
* Thus wrote Chris W. Parker ([EMAIL PROTECTED]): Dan J. Rychlik mailto:[EMAIL PROTECTED] on Tuesday, September 16, 2003 5:12 PM said: Thank you guys. I truly know the level of expertise on this mailing list, and I know that it proves invaluable. p.p.s. I totally think that the

Re: [PHP] Control Structure problem

2003-09-16 Thread Luke Skywalker
- From: Curt Zirzow [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 10:49 AM Subject: Re: [PHP] Control Structure problem * Thus wrote Chris W. Parker ([EMAIL PROTECTED]): Dan J. Rychlik mailto:[EMAIL PROTECTED] on Tuesday, September 16, 2003 5:12 PM said

RE: [PHP] Control Structure problem

2003-09-16 Thread Martin Towell
are you thinking of default: ? -Original Message- From: Luke Skywalker [mailto:[EMAIL PROTECTED] Sent: Wednesday, 17 September 2003 10:51 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Control Structure problem yeah, i really like using cases they work well and especially if you want to do

Re: [PHP] Control Structure problem

2003-09-16 Thread Luke Skywalker
: [PHP] Control Structure problem are you thinking of default: ? -Original Message- From: Luke Skywalker [mailto:[EMAIL PROTECTED] Sent: Wednesday, 17 September 2003 10:51 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Control Structure problem yeah, i really like using cases they work

Re: [PHP] Control Structure problem

2003-09-16 Thread Eugene Lee
On Wed, Sep 17, 2003 at 12:49:03AM +, Curt Zirzow wrote: : : switch ($var) { : case 'TEST-1': case 'TEST-2': case 'TEST-2': : do something : } The switch statement doesn't do an equivalency test, does it? So while this switch statement can be rewritten as: if (($var

Re: [PHP] Control Structure problem

2003-09-16 Thread Curt Zirzow
* Thus wrote Eugene Lee ([EMAIL PROTECTED]): On Wed, Sep 17, 2003 at 12:49:03AM +, Curt Zirzow wrote: The switch statement doesn't do an equivalency test, does it? So while this switch statement can be rewritten as: if (($var == 'TEST-1') || ($var == 'TEST-1') || ($var ==

Re[2]: [PHP] Control Structure problem

2003-09-16 Thread Tom Rogers
Hi, Wednesday, September 17, 2003, 11:47:45 AM, you wrote: EL On Wed, Sep 17, 2003 at 12:49:03AM +, Curt Zirzow wrote: EL : EL : switch ($var) { EL : case 'TEST-1': case 'TEST-2': case 'TEST-2': EL : do something EL : } EL The switch statement doesn't do an equivalency test,

Re: [PHP] Control Structure problem

2003-09-16 Thread Eugene Lee
On Wed, Sep 17, 2003 at 01:29:26PM +1000, Tom Rogers wrote: : Wednesday, September 17, 2003, 11:47:45 AM, Eugene Lee wrote: : : EL The switch statement doesn't do an equivalency test, does it? [...] : EL it doesn't do: : : EL if (($var === 'TEST-1') || : EL($var === 'TEST-1')

Re: [PHP] Control Structure problem

2003-09-16 Thread Chris Shiflett
--- Eugene Lee [EMAIL PROTECTED] wrote: : switch (true) { : case ($var === 'TEST-1')?true:false: : case ($var === 'TEST-2')?true:false: : case ($var === 'TEST-2')?true:false: :do something : } Oh man, that's just sick... Partially because it's unnecessarily

Re: Re[2]: [PHP] Control Structure problem

2003-09-16 Thread Chris Shiflett
--- Tom Rogers [EMAIL PROTECTED] wrote: This is why you need this construct $foo = 0; switch (true) You must have missed example 1. :-) which now works as expected Both examples work as expected, of course. Chris = Become a better Web developer with the HTTP Developer's Handbook

Re: [PHP] control structure question

2002-07-25 Thread Miguel Cruz
On Tue, 23 Jul 2002, Javier Montserat wrote: So refering back, i re-wrote the original example using the switch syntax... switch (true) { case doStep1(): case doStep2(): case doStep3(): error(); break; default: valid(); } Each case expressions is evaluated, until one of them

[PHP] control structure question

2002-07-23 Thread Javier Montserat
is there a more programmatically elegant way of saying... $isError = ; function main() { doStep1(); if (!$isError) { doStep2(); } if (!$isError) { doStep3(); } // etc. etc. } function doStep1() { if ($something) { $isError = 1; } }

Re: [PHP] control structure question

2002-07-23 Thread Martin Clifford
For steps and sequences, I always use switches. Most commonly associated with the action variable, it would look like this: switch($action) { default: // what to show if no variable exists, or is set to a value // that is not acceptable below break; case add_file: //

Re: [PHP] control structure question

2002-07-23 Thread Javier Montserat
So refering back, i re-wrote the original example using the switch syntax... switch (true) { case doStep1(): case doStep2(): case doStep3(): error(); break; default: valid(); } Each case expressions is evaluated, until one of them evaluates to a value equal (==) to the switch expression

[PHP] Control Structure Problem

2001-07-22 Thread Jeff Oien
This is driving me nuts. I couldn't sleep much last night trying to figure this out. This code assigns rooms to kids signing up for Sunday school at a very large church. Each subsequent registration is put into the next room on the list. It looks up in the MySQL database the room the last

RE: [PHP] Control Structure Problem

2001-07-22 Thread Jeff Oien
I forgot to say I deleted tabs so that the width might fit in a typical mail reader. Jeff Oien This code assigns rooms to kids signing up for Sunday school at a very large church. Each subsequent registration is put into the next room on the list. It looks up in the MySQL database the room