Re: [PHP] Logic of conditionals and the ( ) operators

2009-12-18 Thread Ashley Sheridan
On Fri, 2009-12-18 at 10:21 -0800, Allen McCabe wrote: In a nutshell: Will this work? if ($perm == (11 || 12)) Explanation: I am laying the groundwork for a photo viewing system with a private and public mode, and additionally if an admin is logged in, there is an additional

Re: [PHP] Logic of conditionals and the ( ) operators (RESOLVED)

2009-12-18 Thread Allen McCabe
Thank you Ashley, it makes perfect sense. I don't know why I didn't just set up some tests like Shiplu suggested! I've rewritten all my code BACK to the correct way. (I thought it looked cooler, oh well). On Fri, Dec 18, 2009 at 10:47 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On

Re: [PHP] Logic of conditionals and the ( ) operators

2009-12-18 Thread Jonathan Tapicer
Hi, Yes, what Ashley said is correct. Also, if you want to avoid writing $perm several times in the if, or if you have a lot of permissions you can do: if (in_array($perm, array(11, 22))) And you can put in that array all the permissions you need to. Regards, Jonathan On Fri, Dec 18, 2009 at

Re: [PHP] logic operands problem

2009-12-07 Thread Merlin Morgenstern
Devendra Jadhav wrote: what do you think about this? if( ! (page == 1 page == 2)){ //here } Well a simple (and) does not help. I want to have all results that contain either page = 1 OR page = 3, AND in the same time I want to have the results that contain page=2 OR page= 3 , But

Re: [PHP] logic operands problem

2009-12-07 Thread Ashley Sheridan
On Mon, 2009-12-07 at 11:52 +0100, Merlin Morgenstern wrote: Hello everybody, I am having trouble finding a logic for following problem: Should be true if: page = 1 OR page = 3, but it should also be true if page = 2 OR page = 3 The result should never contain 1 AND 2 in the same time.

Re: [PHP] logic operands problem

2009-12-07 Thread Merlin Morgenstern
Ashley Sheridan wrote: On Mon, 2009-12-07 at 11:52 +0100, Merlin Morgenstern wrote: Hello everybody, I am having trouble finding a logic for following problem: Should be true if: page = 1 OR page = 3, but it should also be true if page = 2 OR page = 3 The result should never contain 1 AND

Re: [PHP] logic operands problem

2009-12-07 Thread Ashley Sheridan
On Mon, 2009-12-07 at 12:49 +0100, Merlin Morgenstern wrote: Ashley Sheridan wrote: On Mon, 2009-12-07 at 11:52 +0100, Merlin Morgenstern wrote: Hello everybody, I am having trouble finding a logic for following problem: Should be true if: page = 1 OR page = 3, but it should also

Re: [PHP] logic operands problem

2009-12-07 Thread Lester Caine
Merlin Morgenstern wrote: You have described the problem very well. This is exactly where I can not find a solution. the page number translates to the following: 1= first page 2= following pages 3= all pages This are the options a user has while booking a product on my site. Now if ther is

Re: [PHP] logic operands problem

2009-12-07 Thread Kim Madsen
Hey Merlin Merlin Morgenstern wrote on 2009-12-07 11:52: Hello everybody, I am having trouble finding a logic for following problem: Should be true if: page = 1 OR page = 3, but it should also be true if page = 2 OR page = 3 The result should never contain 1 AND 2 in the same time. This

Re: [PHP] logic operands problem

2009-12-07 Thread tedd
At 11:52 AM +0100 12/7/09, Merlin Morgenstern wrote: Hello everybody, I am having trouble finding a logic for following problem: Should be true if: page = 1 OR page = 3, but it should also be true if page = 2 OR page = 3 The result should never contain 1 AND 2 in the same time. This

Re: [PHP] logic operands problem

2009-12-07 Thread Merlin Morgenstern
Hi everybody, thank you for all the help and thoughts. I have solved it, but I guess it is not an elegant solution. What I do now, is simply check again for the second case. There are 2 cases. Either first page OR all pages, second case: following pages OR all pages. My booking checking

Re: [PHP] Logic puzzle. Not a question. Just for fun

2009-01-06 Thread Chris
If this seems simple to you remember I have no formal training in logic structure or DB design Neither do I - and probably a lot of others here too ;) the value of a status field is given in the sdk text as such... ...This number is determined by adding the following values

Re: [PHP] logic for grabbing what we need from user-input addresses for AVS?

2008-10-19 Thread Ashley Sheridan
On Sun, 2008-10-19 at 01:10 -0400, Robert Cummings wrote: On Sat, 2008-10-18 at 22:56 -0600, Govinda wrote: Hi all This is not exactly PHP, but an issue that we have to work out in code (whatever we use) - I am working on a shopping cart site which will have orders from any

Re: [PHP] logic for grabbing what we need from user-input addresses for AVS?

2008-10-19 Thread Govinda
On Oct 18, 2008, at 11:10 PM, Robert Cummings wrote: On Sat, 2008-10-18 at 22:56 -0600, Govinda wrote: To cut down on fraudulent orders, our cc processor (whatever we call them), to enable Address Verification System (AVS), ... The docs make this clear that they want: The numeric

Re: [PHP] logic for grabbing what we need from user-input addresses for AVS?

2008-10-19 Thread Robert Cummings
On Sun, 2008-10-19 at 10:03 +0100, Ashley Sheridan wrote: On Sun, 2008-10-19 at 01:10 -0400, Robert Cummings wrote: On Sat, 2008-10-18 at 22:56 -0600, Govinda wrote: Hi all This is not exactly PHP, but an issue that we have to work out in code (whatever we use) - I am working

Re: [PHP] logic for grabbing what we need from user-input addresses for AVS?

2008-10-19 Thread Ashley Sheridan
On Sun, 2008-10-19 at 11:26 -0400, Robert Cummings wrote: On Sun, 2008-10-19 at 10:03 +0100, Ashley Sheridan wrote: On Sun, 2008-10-19 at 01:10 -0400, Robert Cummings wrote: On Sat, 2008-10-18 at 22:56 -0600, Govinda wrote: Hi all This is not exactly PHP, but an issue that we

Re: [PHP] logic for grabbing what we need from user-input addresses for AVS?

2008-10-18 Thread Waynn Lue
AVS generally only exists for us and canada and parts of the uk, if I remember correctly. Usually they're just looking for the beginning part of the street address, not the concatenation or anything else like that. No need for apartment numbers, for example if you're just looking at avs. If

Re: [PHP] logic for grabbing what we need from user-input addresses for AVS?

2008-10-18 Thread Robert Cummings
On Sat, 2008-10-18 at 22:56 -0600, Govinda wrote: Hi all This is not exactly PHP, but an issue that we have to work out in code (whatever we use) - I am working on a shopping cart site which will have orders from any country. To cut down on fraudulent orders, our cc processor

Re: [PHP] Logic sought

2008-07-10 Thread Per Jessen
tedd wrote: If two, or more, users hit the site at the same time then a RACE condition may have one user getting something they didn't ask for or not getting anything at all. The complicated way I figure I could solve this would be to: 1. Generate a random string name for the file --

Re: [PHP] Logic sought

2008-07-09 Thread Kyle Browning
Write a script that cron runs that checks dates of files and removes 1 month old ones? On Wed, Jul 9, 2008 at 4:45 PM, tedd [EMAIL PROTECTED] wrote: Hi gang: Here's the logic problem. First the site: http://php1.net/b/zip-files/ Now, the site works well enough. The user selects what

Re: [PHP] Logic sought

2008-07-09 Thread Eric Butera
On Wed, Jul 9, 2008 at 7:45 PM, tedd [EMAIL PROTECTED] wrote: Hi gang: Here's the logic problem. First the site: http://php1.net/b/zip-files/ Now, the site works well enough. The user selects what they want, clicks Submit, the order is assembled in zip file and presented to the user for

Re: [PHP] Logic sought

2008-07-09 Thread Jochem Maas
generate a unique hash as the name based on the contents of the zip, then if 2 people happen to want exactly the same selection you won't have to build/zip it twice ... just check if the zip happens to exist before trying to build it. have the script do garbage collection on old zip files ...

Re: [PHP] Logic sought

2008-07-09 Thread Nathan Nobbe
On Wed, Jul 9, 2008 at 6:11 PM, Jochem Maas [EMAIL PROTECTED] wrote: generate a unique hash as the name based on the contents of the zip, then if 2 people happen to want exactly the same selection you won't have to build/zip it twice ... just check if the zip happens to exist before trying

Re: [PHP] Logic sought

2008-07-09 Thread Jim Lucas
tedd wrote: Hi gang: Here's the logic problem. First the site: http://php1.net/b/zip-files/ Now, the site works well enough. The user selects what they want, clicks Submit, the order is assembled in zip file and presented to the user for downloading. However, as it stands now, before the

Re: [PHP] Logic Help please

2007-11-22 Thread Richard Heyes
Hi, I am doing an online calendar for holiday application. Now I got a table with these fields among many others. `req_id` int(11) NOT NULL auto_increment, `req_date` date NOT NULL, `username` varchar(100) NOT NULL, `start_date` date NOT NULL, `end_date` date NOT NULL, `days_off`

Re: [PHP] logic with arrays

2004-12-15 Thread Greg Donald
On Thu, 16 Dec 2004 13:11:02 +1100, Jeffery Fernandez [EMAIL PROTECTED] wrote: I am trying to build a html menu dynamically from data sitting in an array. I have been successful so far until it came to the point of populating the sub-menu of the system. Can someone help me out with the logic

Re: [PHP] logic with arrays

2004-12-15 Thread Jeffery Fernandez
Wee Keat wrote: Hey Jeff, How are you mate? Was lazying around and saw your email to the list. :) What exactly do you need help with? Is it the following line? // Stuck here $html_menu .= lia href=\Need to get value\$sub_page/a/li; } $html_menu .= '/ul'; Do you

Re: [PHP] Logic problem

2004-04-20 Thread John Nichel
Alex Hogan wrote: Hi All, I am having a logic problem. (insert jokes here) I am trying to create a function that will allow me to pass any number of fields and tables into a blanket query. I am getting an error; Unexpected foreach. I have tried placing the loop in several different places and

RE: [PHP] Logic problem

2004-04-20 Thread Alex Hogan
[snip] $query = SELECT ; $start = true; foreach ( $array1 as $flds ) { if ( $start ) { $query .= $flds[$i]; $start = false; } else { $query .= , . $flds[$i]; } } $query .= FROM ; $start = true; foreach ( $array2 as $tbls )

RE: [PHP] Logic problem

2004-04-20 Thread Alex Hogan
[snip] I do have one question though. I ran your code and it only returns the first letter for that element in the array. For instance fieldone returns as f and tableone returns as t. The output looks like this; SELECT f,f,f FROM t,t. [/snip] Never mind I found it. It should be; $query =

Re: [PHP] Logic problem

2004-04-20 Thread Kelly Hallman
Apr 20 at 9:55am, Alex Hogan wrote: function myselect($array1, $array2){ $query = SELECT.foreach($array1 as $flds){ $flds[$i]; }. FROM.foreach($array2 as $tbls){ $tbls[$n]; } ... Alex, if you merely wish to place the values of an array into your query, you might also try doing it this

RE: [PHP] Logic problem

2004-04-20 Thread Ford, Mike [LSS]
On 20 April 2004 16:44, Alex Hogan wrote: foreach ( $array1 as $flds ) { if ( $start ) { $query .= $flds; $start = false; } else { $query .= , . $flds; } } $query .= implode(, , $array1); Cheers! Mike

Re: [PHP] Logic problem

2004-04-20 Thread John Nichel
Alex Hogan wrote: snip I gotcha.., I do have one question though. I ran your code and it only returns the first letter for that element in the array. For instance fieldone returns as f and tableone returns as t. The output looks like this; SELECT f,f,f FROM t,t. alex What's in your array?

RE: [PHP] Logic problem

2004-04-20 Thread Alex Hogan
What's in your array? $array1[0] = 'firstname'; $array1[1] = 'lastname'; $array1[2] = 'tkt_title'; I got that fixed. Thanks. alex hogan ** The contents of this e-mail and any files transmitted with it are confidential and

Re: [PHP] Logic headache, please help.

2002-11-11 Thread Marco Tabini
How about building an array of all the levels: $a = array(); for ($i = 1; $i = $maxlevels; $i++) $a[] = $i; then for each level you can create a new array that is the difference between the original array and an array that contains the current level: for ($i = 1; $i = $maxlevels; $i++)

RE: [PHP] Logic headache, please help.

2002-11-11 Thread Tony Crockford
-Original Message- From: Marco Tabini [mailto:marcot;tabini.ca] Sent: 11 November 2002 14:46 To: Tony Crockford Cc: Php-GeneralLists. Php. Net Subject: Re: [PHP] Logic headache, please help. How about building an array of all the levels: $a = array(); for ($i = 1; $i

RE: [PHP] Logic headache, please help.

2002-11-11 Thread Marco Tabini
Crockford wrote: -Original Message- From: Marco Tabini [mailto:marcot;tabini.ca] Sent: 11 November 2002 14:46 To: Tony Crockford Cc: Php-GeneralLists. Php. Net Subject: Re: [PHP] Logic headache, please help. How about building an array of all the levels: $a = array

Re: [PHP] Logic -- conditional statements

2002-06-04 Thread Analysis Solutions
On Tue, Jun 04, 2002 at 04:40:26AM +0400, Ricardo Fitzgerald wrote: I'm trying to echo a neat table I've GOT to bust your chops. That table and your code are anything BUT neat. For neat, you need to put /td tags to close each cell. Also nest your code properly... if ($value2 ==0) {

RE: [PHP] Logic -- conditional statements

2002-06-04 Thread Naintara Jain
The problem here is that you have defined three different variables $value1,$value2,$value3. Keep only one variable (say,$valueChk) that can take values 1,2 or 3. Then check for the condition. And there's another mistake in the script, you are checking ---if ($value2 ==0)--- twice, you probably

RE: [PHP] Logic -- conditional statements

2002-06-04 Thread John Holmes
] [mailto:[EMAIL PROTECTED] t]On Behalf Of Naintara Jain Sent: Tuesday, June 04, 2002 2:37 PM To: Ricardo Fitzgerald; [EMAIL PROTECTED] Subject: RE: [PHP] Logic -- conditional statements The problem here is that you have defined three different variables $value1,$value2,$value3. Keep

Re: [PHP] Logic

2001-12-04 Thread Richard S. Crawford
You need parentheses around the entire antecedent: if (($type !=add) || ($type !=edit) || ($type !=delete)) { //etc ^--- Note these parentheses---^ Hope that helps. At 05:28 PM 12/4/2001, Dan McCullough wrote: Question. I am trying to check to see if a

Re: [PHP] Logic

2001-12-04 Thread Dan McCullough
that didnt work,i started off with if ($type != add) { that works } else { this works } I have done this before I'm just having a brain cramp. if (($type != add) || ($type != edit) || ($type != delete)) { print $subcat_output; } else { print TRTD BGCOLOR=\#F7F7F7\ WIDTH=\20%\/TDTD

RE: [PHP] Logic

2001-12-04 Thread Martin Towell
now change || to and see if that does the job -Original Message- From: Dan McCullough [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 05, 2001 12:57 PM To: PHP General List Cc: Richard S. Crawford Subject: Re: [PHP] Logic that didnt work,i started off with if ($type != add

Re: [PHP] Logic

2001-12-04 Thread Steve Werby
Dan McCullough [EMAIL PROTECTED] wrote: Question. I am trying to check to see if a certain piece of code should be run. Here is an example. if ($type != add) || ($type != edit) || ($type != delete) {//if this or this or this then then run this code As pointed out, your paranthesis will

Re: [PHP]logic question

2001-07-22 Thread rm
try: http://php.resourceindex.com/Complete_Scripts/Link_Management/ you should be able to find some examples here. __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ -- PHP