Re: [PHP] If date is greater than

2013-10-20 Thread Tedd Sperling
On Oct 20, 2013, at 4:01 AM, Ashley Sheridan wrote: > Yes, I was going to ask, why are you storing your dates as strings? > MySQL has a perfectly good DATE type. It's also generally faster > comparing dates within a MySQL query than PHP code. > > Thanks, > Ash > http://www.ashleysheridan.co.uk

Re: [PHP] If date is greater than

2013-10-20 Thread Ashley Sheridan
On Sun, 2013-10-20 at 00:00 -0400, Bastien wrote: > > Thanks, > > Bastien > > > On Oct 19, 2013, at 10:44 PM, John Taylor-Johnston > > wrote: > > > > I have date strings in my mysql db. -mm-dd. > > I want to parse to see if the date is greater than november 2011 and less > > than decemb

Re: [PHP] if (empty versus if (isset

2013-02-20 Thread Tedd Sperling
On Feb 20, 2013, at 9:10 AM, Jim Giner wrote: > Basically it tells a savvy programmer whether or not his logic has caused the > var in question to "exist". Many times it is important simply to know that, > not what the var contains, which can lead to an error in processing. > > The isset() wi

Re: [PHP] if (empty versus if (isset

2013-02-20 Thread ma...@behnke.biz
isset checks if something is defined or if an array has a key with a value other than null read: http://www.php.net/manual/en/function.isset.php#refsect1-function.isset-returnvalues empty check isset PLUS if the value is not null, false, 0 and wahtever php thinks is empty read: http://www.php.ne

Re: [PHP] if (empty versus if (isset

2013-02-19 Thread Adam Richardson
On Tue, Feb 19, 2013 at 9:29 PM, John Taylor-Johnston wrote: > > What is the difference between? > > if (empty... http://www.php.net/manual/en/function.empty.php "Determine > whether a variable is empty" > and > if (isset... http://php.net/manual/en/function.isset.php "Determine if a > variable

[PHP] if (empty versus if (isset

2013-02-19 Thread John Taylor-Johnston
What is the difference between? if (empty... http://www.php.net/manual/en/function.empty.php "Determine whether a variable is empty" and if (isset... http://php.net/manual/en/function.isset.php "Determine if a variable is set and is not *|NULL|*" I have an . If it is not checked, it is NOT

Re: [PHP] If PHP Were British

2012-06-22 Thread Bastien
I bow to your skillz! That was pretty awesome! Bastien Koert On 2012-06-22, at 7:02 PM, Daniel Brown wrote: > On Fri, Jun 22, 2012 at 5:07 PM, Daevid Vincent wrote: >> http://www.addedbytes.com/blog/if-php-were-british/ > >Eh, what the hell, it's Friday > >http://links.parasa

Re: [PHP] If PHP Were British

2012-06-22 Thread Mark Rousell
On 22/06/2012 22:07, Daevid Vincent wrote: > http://www.addedbytes.com/blog/if-php-were-british/ LOL! -- Mark Rousell PGP public key: http://www.signal100.com/markr/pgp Key ID: C9C5C162 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub

RE: [PHP] If PHP Were British

2012-06-22 Thread Daevid Vincent
> -Original Message- > From: paras...@gmail.com [mailto:paras...@gmail.com] On Behalf Of Daniel Brown > Sent: Friday, June 22, 2012 4:03 PM > To: Daevid Vincent > Cc: php-general@lists.php.net > Subject: Re: [PHP] If PHP Were British > > On Fri, Jun 22, 2012 at

Re: [PHP] If PHP Were British

2012-06-22 Thread Daniel Brown
On Fri, Jun 22, 2012 at 5:07 PM, Daevid Vincent wrote: > http://www.addedbytes.com/blog/if-php-were-british/ Eh, what the hell, it's Friday http://links.parasane.net/eea4 -- Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/)

Re: [PHP] If PHP Were British

2012-06-22 Thread Tedd Sperling
On Jun 22, 2012, at 5:07 PM, Daevid Vincent wrote: > http://www.addedbytes.com/blog/if-php-were-british/ Oh, that is too funny! I'll counter with my Hill-Billy version: --- echo(); yell('revenewers commin'); --- var_dump(); take_a_dump(); preferred: leave_one(); --- if:

[PHP] If PHP Were British

2012-06-22 Thread Daevid Vincent
http://www.addedbytes.com/blog/if-php-were-british/

Re: [PHP] if http_referer is not reliable then how do we ...

2012-01-19 Thread tamouse mailing lists
On Tue, Jan 17, 2012 at 2:34 AM, ma...@behnke.biz wrote: > You should not write the recipients email address in a hidden form, but > instead > read it from a config file. This way you can make sure, that no one alters it. > Although this won't stop anyone from using the mailform. Cannot emphasiz

Re: [PHP] if http_referer is not reliable then how do we ...

2012-01-19 Thread Alex Nikitin
Capchas can't hold off any decently smart robots, anyone doing their research can find at least 3 tools that will defeat various capchas. For example pwntcha is one, Dan Kaminsky did a talk at black hat and defcon 16 on pwning audio capchas (and a lot of even good ones will offer audio as an option

Re: [PHP] if http_referer is not reliable then how do we ...

2012-01-17 Thread ma...@behnke.biz
Haluk Karamete hat am 17. Januar 2012 um 04:51 geschrieben: > Let' say we have a form mailer script, which takes any form ( whose > action is directed to it ) and goes thru the submitting form's fields > list ( programmatically) , to build a nice email on the fly and email > the build up string

[PHP] if http_referer is not reliable then how do we ...

2012-01-16 Thread Haluk Karamete
Let' say we have a form mailer script, which takes any form ( whose action is directed to it ) and goes thru the submitting form's fields list ( programmatically) , to build a nice email on the fly and email the build up string to the email address that's coming in the hidden field. Let's say that'

Re: [PHP] IF stream lining

2011-07-14 Thread tamouse mailing lists
That's already pretty streamlined... On Jul 13, 2011 11:22 PM, "Ron Piggott" wrote: > > Is there a way to stream line this: > > if ( ( $val <> "with" ) AND ( $val <> "from" ) ) { > > Ron > > The Verse of the Day > “Encouragement from God’s Word” > http://www.TheVerseOfTheDay.info

Re: [PHP] IF stream lining

2011-07-13 Thread Alex Nikitin
if( $val !== "with" && $val !== "from") simple comparison = faster solution... also you want type-safe you could do something like if(!in_array($val, array("from","with"))) but its neither elegant nor fast On Jul 14, 2011 12:22 AM, "Ron Piggott" wrote:

[PHP] IF stream lining

2011-07-13 Thread Ron Piggott
Is there a way to stream line this: if ( ( $val <> "with" ) AND ( $val <> "from" ) ) { Ron The Verse of the Day “Encouragement from God’s Word” http://www.TheVerseOfTheDay.info

Re: [PHP] If Statements Array and Notice Undefined Index

2011-03-31 Thread Nicholas Cooper
On 31 March 2011 15:53, Stuart Dallas wrote: > On Thursday, 31 March 2011 at 15:45, Nicholas Cooper wrote: > Good day, > > > > I have three arrays A, B and C. Anyone of them might not have the 'id' > key > > set which will give the Notice "Undefined index: id". > > > > I just wanted to know what

Re: [PHP] If Statements Array and Notice Undefined Index

2011-03-31 Thread Stuart Dallas
On Thursday, 31 March 2011 at 15:45, Nicholas Cooper wrote: Good day, > > I have three arrays A, B and C. Anyone of them might not have the 'id' key > set which will give the Notice "Undefined index: id". > > I just wanted to know what the correct approach to this problem would be; > without maki

[PHP] If Statements Array and Notice Undefined Index

2011-03-31 Thread Nicholas Cooper
Good day, I have three arrays A, B and C. Anyone of them might not have the 'id' key set which will give the Notice "Undefined index: id". I just wanted to know what the correct approach to this problem would be; without making the code overly complicated to read by introducing a number of "if is

RE: [PHP] if/elseif being treated as if/if

2010-09-27 Thread tedd
At 11:48 AM +0100 9/27/10, Ford, Mike wrote: > -Original Message- From: tedd [mailto:tedd.sperl...@gmail.com] Sent: 25 September 2010 16:02 One can make the argument that the ELSE IF statement first surfaced circa 1977 in FORTRAN 77 and the CASE statement came later in FORTRAN

RE: [PHP] if/elseif being treated as if/if

2010-09-27 Thread Ford, Mike
> -Original Message- > From: tedd [mailto:tedd.sperl...@gmail.com] > Sent: 25 September 2010 16:02 > One can make the argument that the ELSE IF statement first surfaced > circa 1977 in FORTRAN 77 and the CASE statement came later in > FORTRAN > 90 circa 1991. Being a fully-fledged membe

RE: [PHP] if/elseif being treated as if/if

2010-09-25 Thread tedd
At 9:04 PM +0100 9/24/10, Ashley Sheridan wrote: I don't often use this type of logic, but I have used it before and it's served me well. Essentially, a switch is a glorified if statement, and I find them a lot nicer to read and write than a series of if/elseif blocks. Thanks, Ash Ash: Exa

RE: [PHP] if/elseif being treated as if/if

2010-09-25 Thread tedd
At 3:54 PM -0400 9/24/10, Bob McConnell wrote: From: tedd At 2:23 PM -0400 9/24/10, Bob McConnell wrote: >>A switch works when a single test can dispatch all possible branches. If you have a series of tests where each looks for a different subset of >>conditions, you need an elseif.

Re: [PHP] if/elseif being treated as if/if

2010-09-24 Thread Ashley Sheridan
On Fri, 2010-09-24 at 16:08 -0400, Joshua Kehn wrote: > On Sep 24, 2010, at 4:04 PM, Ashley Sheridan wrote: > > > On Fri, 2010-09-24 at 15:54 -0400, Bob McConnell wrote: > > > >> From: tedd > >> > >>> At 2:23 PM -0400 9/24/10, Bob McConnell wrote: > > A switch works when a single tes

RE: [PHP] if/elseif being treated as if/if

2010-09-24 Thread Ashley Sheridan
On Fri, 2010-09-24 at 15:54 -0400, Bob McConnell wrote: > From: tedd > > > At 2:23 PM -0400 9/24/10, Bob McConnell wrote: > >> > >>A switch works when a single test can dispatch all possible branches. > If > >>you have a series of tests where each looks for a different subset of > >>conditions,

RE: [PHP] if/elseif being treated as if/if

2010-09-24 Thread Ashley Sheridan
On Fri, 2010-09-24 at 15:44 -0400, Steve Staples wrote: > this would be the same as: > (commented below) > > On Fri, 2010-09-24 at 15:30 -0400, tedd wrote: > > At 2:23 PM -0400 9/24/10, Bob McConnell wrote: > > > > > >A switch works when a single test can dispatch all possible branches. If > > >y

RE: [PHP] if/elseif being treated as if/if

2010-09-24 Thread Bob McConnell
From: tedd > At 2:23 PM -0400 9/24/10, Bob McConnell wrote: >> >>A switch works when a single test can dispatch all possible branches. If >>you have a series of tests where each looks for a different subset of >>conditions, you need an elseif. > Not so, O'wise one. > > This will work: > > swit

RE: [PHP] if/elseif being treated as if/if

2010-09-24 Thread Steve Staples
this would be the same as: (commented below) On Fri, 2010-09-24 at 15:30 -0400, tedd wrote: > At 2:23 PM -0400 9/24/10, Bob McConnell wrote: > > > >A switch works when a single test can dispatch all possible branches. If > >you have a series of tests where each looks for a different subset of > >c

RE: [PHP] if/elseif being treated as if/if

2010-09-24 Thread tedd
At 2:23 PM -0400 9/24/10, Bob McConnell wrote: A switch works when a single test can dispatch all possible branches. If you have a series of tests where each looks for a different subset of conditions, you need an elseif. Bob McConnell Bob: Not so, O'wise one. This will work: switch(1)

RE: [PHP] if/elseif being treated as if/if

2010-09-24 Thread Jay Blanchard
[snip] I am not in the majority when I say for conditions where you have more than two options use a switch control and not an elseif. In 40+ years of programming, I have never used elseif because the control confuses me. It is *much* easier for me to use, understand, and document a switch stat

Re: [PHP] if/elseif being treated as if/if

2010-09-24 Thread Andy McKenzie
I found the problem while I was copying the code over. The problem is that the if triggers in loop one, and the elseif triggers in loop two. In other words, it does exactly what it's supposed to, I just didn't think through what the loop would accomplish. Now to figure out how to make it do what

RE: [PHP] if/elseif being treated as if/if

2010-09-24 Thread Bob McConnell
From: tedd > At 1:50 PM -0400 9/24/10, Andy McKenzie wrote: >>Hey folks, >> >> Here's the deal. I have the following code: >> >>if($col_vals[$i][$val['column']] == $search_result[0][$col]) >> { echo ' selected="selected"'; } >>elseif($val['default'] == $col_vals[$i][$val['column']]) >

Re: [PHP] if/elseif being treated as if/if

2010-09-24 Thread tedd
At 1:50 PM -0400 9/24/10, Andy McKenzie wrote: Hey folks, Here's the deal. I have the following code: if($col_vals[$i][$val['column']] == $search_result[0][$col]) { echo ' selected="selected"'; } elseif($val['default'] == $col_vals[$i][$val['column']]) { echo ' selected="

Re: [PHP] if/elseif being treated as if/if

2010-09-24 Thread Marc Guay
if(1 == 1){ echo 'here'; } elseif(1 == 1){ echo 'here"'; } Will only echo "here" once. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] if/elseif being treated as if/if

2010-09-24 Thread chris h
Andy I see no reason why both echo's would fire; unless this block of code gets executed multiple times. can we see more of the code? Chris H. On Fri, Sep 24, 2010 at 1:50 PM, Andy McKenzie wrote: > Hey folks, > > Here's the deal. I have the following code: > > if($col_vals[$i][$val['column

[PHP] if/elseif being treated as if/if

2010-09-24 Thread Andy McKenzie
Hey folks, Here's the deal. I have the following code: if($col_vals[$i][$val['column']] == $search_result[0][$col]) { echo ' selected="selected"'; } elseif($val['default'] == $col_vals[$i][$val['column']]) { echo ' selected="selected"'; } It's supposed to check whether t

Re: [PHP] If the first four characters are "0000", then do {} - timing tests

2010-01-27 Thread Daniel Brown
On Tue, Jan 26, 2010 at 19:48, Daevid Vincent wrote: > > Another thing I just noticed, is that we (that is Dan and I) should NOT > have used count() > This is bad form and wasted cycles. This is certainly correct, but it should also be noted that my original code used it once (thus, it was in

RE: [PHP] If the first four characters are "0000", then do {}

2010-01-27 Thread Ford, Mike
> -Original Message- > From: Daevid Vincent [mailto:dae...@daevid.com] > Sent: 26 January 2010 03:52 > > if (substr($mydata->restored,0,4) == "") { } > > Or in your very specific case you could do the harder way and note > that > strings work like simple arrays too in a way, so $mydat

RE: [PHP] If the first four characters are "0000", then do {} - timing tests

2010-01-26 Thread Daevid Vincent
> -Original Message- > From: muquad...@gmail.com [mailto:muquad...@gmail.com] On > Behalf Of shiplu > Sent: Tuesday, January 26, 2010 4:25 PM > To: Daniel Brown > Cc: Daevid Vincent; PHP-General > Subject: Re: [PHP] If the first four characters are ""

Re: [PHP] If the first four characters are "0000", then do {} - timing tests

2010-01-26 Thread shiplu
Ran this code (http://pastie.org/795983) The result is, array of 10,000 Array ( [[]] => 5.66168689728 [strpos] => 5.70796895027 [substr] => 5.92751288414 [preg_match] => 6.21515512466 ) -- Shiplu Mokaddim My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu S

Re: [PHP] If the first four characters are "0000", then do {} - timing tests

2010-01-26 Thread Daniel Brown
On Tue, Jan 26, 2010 at 17:17, Daevid Vincent wrote: > > Well allow me to retort... :) > > Your test was for 5 measly array elements. > > Just for S&G I tried it with the strpos one too and modified your test > slightly to handle bigger arrays... > [snip=code] > > I ran out of memory with more tha

RE: [PHP] If the first four characters are "0000", then do {} - timing tests

2010-01-26 Thread Daevid Vincent
> -Original Message- > From: paras...@gmail.com [mailto:paras...@gmail.com] On > Behalf Of Daniel Brown > Sent: Tuesday, January 26, 2010 8:21 AM > To: Daevid Vincent > Cc: John Taylor-Johnston; PHP-General > Subject: Re: [PHP] If the first four character

Re: [PHP] If the first four characters are "0000", then do {}

2010-01-26 Thread Daniel Brown
On Mon, Jan 25, 2010 at 22:51, Daevid Vincent wrote: >> -Original Message- >> From: paras...@gmail.com [mailto:paras...@gmail.com] On >> Behalf Of Daniel Brown >> Sent: Monday, January 25, 2010 6:43 PM >> To: John Taylor-Johnston >> Cc: PHP-General >

Re: [PHP] If the first four characters are "0000", then do {}

2010-01-26 Thread paragasu
maybe another way can be $str = explode('-',$mydata->restored); if($str[0] == '') { dostuff();} ;) On 1/26/10, shiplu wrote: > Another technique could be. > > $s = $mydata->restored; > > if($s[0]==$s[1] > && $s[1]==$s[2] > && $s[2]==$s[3] > && $s[3]==0){ > > do_work(); > } > > > But I

Re: [PHP] If the first four characters are "0000", then do {}

2010-01-26 Thread shiplu
Another technique could be. $s = $mydata->restored; if($s[0]==$s[1] && $s[1]==$s[2] && $s[2]==$s[3] && $s[3]==0){ do_work(); } But I think you got the best solution already. -- Shiplu Mokaddim My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://g

Re: [PHP] If the first four characters are "0000", then do {}

2010-01-25 Thread Paul M Foster
On Mon, Jan 25, 2010 at 08:12:43PM -0800, Daevid Vincent wrote: > > -Original Message- > > From: Paul M Foster [mailto:pa...@quillandmouse.com] > > Sent: Monday, January 25, 2010 8:05 PM > > To: php-general@lists.php.net > > Subject: Re: [PHP] If the first fo

Re: [PHP] If the first four characters are "0000", then do {}

2010-01-25 Thread Andrew Ballard
On Mon, Jan 25, 2010 at 11:12 PM, Daevid Vincent wrote: >> >From what I understand, strpos() faster than a lot of other similar >> string functions and much faster than regexps. You could do: >> >> if (strpos($mydata->restored, '') === 0) { >>       do_stuff(); >> } > > Ah. Clever use of the "

RE: [PHP] If the first four characters are "0000", then do {}

2010-01-25 Thread Daevid Vincent
> -Original Message- > From: Paul M Foster [mailto:pa...@quillandmouse.com] > Sent: Monday, January 25, 2010 8:05 PM > To: php-general@lists.php.net > Subject: Re: [PHP] If the first four characters are "", then do {} > > On Mon, Jan 25, 2010 at 09:36:5

Re: [PHP] If the first four characters are "0000", then do {}

2010-01-25 Thread Paul M Foster
On Mon, Jan 25, 2010 at 09:36:50PM -0500, John Taylor-Johnston wrote: > I am reading the manual: http://ca.php.net/manual/en/ref.strings.php > > $mydata->restored = "-00-00"; > > How do I express this? If the first four characters are "", then do {} > > What I am looking for is in strpos()

RE: [PHP] If the first four characters are "0000", then do {}

2010-01-25 Thread Daevid Vincent
> -Original Message- > From: paras...@gmail.com [mailto:paras...@gmail.com] On > Behalf Of Daniel Brown > Sent: Monday, January 25, 2010 6:43 PM > To: John Taylor-Johnston > Cc: PHP-General > Subject: Re: [PHP] If the first four characters are "", then

Re: [PHP] If the first four characters are "0000", then do {}

2010-01-25 Thread Angus Mann
- Original Message - From: "John Taylor-Johnston" To: "PHP-General" Sent: Tuesday, January 26, 2010 12:36 PM Subject: [PHP] If the first four characters are "", then do {} I am reading the manual: http://ca.php.net/manual/en/ref.strings.php $

Re: [PHP] If the first four characters are "0000", then do {}

2010-01-25 Thread Daniel Brown
On Mon, Jan 25, 2010 at 21:36, John Taylor-Johnston wrote: > I am reading the manual: http://ca.php.net/manual/en/ref.strings.php > > $mydata->restored = "-00-00"; -- daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Looking for hosting or

[PHP] If the first four characters are "0000", then do {}

2010-01-25 Thread John Taylor-Johnston
I am reading the manual: http://ca.php.net/manual/en/ref.strings.php $mydata->restored = "-00-00"; How do I express this? If the first four characters are "", then do {} What I am looking for is in strpos(), no? if () { } -- PHP General Mailing List (http://www.php.net/) T

Re: [PHP] If design patterns are not supposed to produce reusable code then why use them?

2010-01-05 Thread Bipper Goes!
A pattern is simply a device used to skip out on costly dollars (as opposed to cheap dollars). Software development is a low loyalties field. When new workers come in and old ones are laid off, or when the project is complete and you will likely not be working on the project again in the future,

Re: [PHP] If design patterns are not supposed to produce reusable code then why use them?

2010-01-04 Thread Robert Cummings
Richard Quadling wrote: 2009/12/30 Tony Marston : I have recently been engaged in an argument via email with someone who criticises my low opinion of design patterns (refer to http://www.tonymarston.net/php-mysql/design-patterns.html ). He says that design patterns are merely a convention and no

Re: [PHP] If design patterns are not supposed to produce reusable code then why use them?

2010-01-04 Thread Richard Quadling
2009/12/30 Tony Marston : > I have recently been engaged in an argument via email with someone who > criticises my low opinion of design patterns (refer to > http://www.tonymarston.net/php-mysql/design-patterns.html ). He says that > design patterns are merely a convention and not a reusable compon

Re: [PHP] If design patterns are not supposed to produce reusable code then why use them?

2010-01-03 Thread Daniel Egeberg
I think it also to some extent comes down to having a shared vocabulary. Pretty much the same way that you know which technique I'm talking about when I use the word "recursion", which algorithm I'm talking about when I say "quick sort" and which data structure I mean when I say "linked list". It's

Re: [PHP] If design patterns are not supposed to produce reusable code then why use them?

2010-01-03 Thread tedd
At 5:16 PM + 1/3/10, Tony Marston wrote: I offer an alternative view - there are those programmers who need design patterns to fill a hole in their experience, as a sort of mental crutch, and there are those who do not need design patterns as they have the experience and ability to work with

Re: [PHP] If design patterns are not supposed to produce reusable code then why use them?

2010-01-03 Thread Tony Marston
"Larry Garfield" wrote in message news:201001010553.41956.la...@garfieldtech.com... > On Friday 01 January 2010 05:26:48 am Tony Marston wrote: > >> > It depends what you're reusing. Design patterns are reusable concepts, >> > not reusable code. That's the key difference. >> > >> > Knowledge o

Re: [PHP] If design patterns are not supposed to produce reusable code then why use them?

2010-01-01 Thread Larry Garfield
On Friday 01 January 2010 05:26:48 am Tony Marston wrote: > > It depends what you're reusing. Design patterns are reusable concepts, > > not > > reusable code. That's the key difference. > > > > Knowledge of design patterns is like knowledge of how different food > > ingredients interact. "Hm,

Re: [PHP] If design patterns are not supposed to produce reusable code then why use them?

2010-01-01 Thread Tony Marston
"Larry Garfield" wrote in message news:200912311743.16759.la...@garfieldtech.com... > Meant to send this to the list, sorry. > > -- Forwarded Message -- > > Subject: Re: [PHP] If design patterns are not supposed to produce reusable > code then why u

Re: [PHP] If design patterns are not supposed to produce reusable code then why use them?

2009-12-31 Thread Larry Garfield
Meant to send this to the list, sorry. -- Forwarded Message -- Subject: Re: [PHP] If design patterns are not supposed to produce reusable code then why use them? Date: Thursday 31 December 2009 From: Larry Garfield To: "Tony Marston" On Wednesday 30 December 200

Re: [PHP] If design patterns are not supposed to produce reusable code then why use them?

2009-12-30 Thread Paul M Foster
On Wed, Dec 30, 2009 at 04:50:40PM -, Tony Marston wrote: > I have recently been engaged in an argument via email with someone who > criticises my low opinion of design patterns (refer to > http://www.tonymarston.net/php-mysql/design-patterns.html ). He says that > design patterns are merely a

Re: [PHP] If design patterns are not supposed to produce reusable code then why use them?

2009-12-30 Thread tedd
At 4:50 PM + 12/30/09, Tony Marston wrote: What is your opinion? Are design patterns supposed to provide reusable code or not? If not, and each implementation of a pattern takes just as much time as the first, then where are the productivity gains from using design patterns? -- Tony Marston

Re: [PHP] If design patterns are not supposed to produce reusable code then why use them?

2009-12-30 Thread Ashley Sheridan
On Wed, 2009-12-30 at 16:50 +, Tony Marston wrote: > I have recently been engaged in an argument via email with someone who > criticises my low opinion of design patterns (refer to > http://www.tonymarston.net/php-mysql/design-patterns.html ). He says that > design patterns are merely a con

[PHP] If design patterns are not supposed to produce reusable code then why use them?

2009-12-30 Thread Tony Marston
I have recently been engaged in an argument via email with someone who criticises my low opinion of design patterns (refer to http://www.tonymarston.net/php-mysql/design-patterns.html ). He says that design patterns are merely a convention and not a reusable component. My argument is that somet

Re: [PHP] if elseif elseif elseif....

2009-03-07 Thread Paul M Foster
On Sun, Mar 08, 2009 at 03:03:33PM +1100, Naz wrote: > > Generally, the approach I take is as follows: > > $errors = array(); > if (empty($_POST['name'])) >array_push($errors, 'A name was not entered.'); > if (empty($_POST['address'])) >array_push($errors, 'An address was no supplied.'); >

Re: [PHP] if elseif elseif elseif....

2009-03-07 Thread Naz
PJ wrote: This is probably a mysql question, but their list is rather dull - I think they don't appreciate my humor. Beside this list is fun ... and informative. Anyway, I can't figure this out. I am trying to verify inputs on a form and even if I have all the required fields right, I still get t

Re: [PHP] if elseif elseif elseif....

2009-03-05 Thread Al
Al wrote: PJ wrote: PJ wrote: Daniel Brown wrote: On Wed, Mar 4, 2009 at 17:51, PJ wrote: elseif ($obligatoryFieldNotPresent = 1) { $obligatoryFieldNotPresent = 0; } Are you certain you only wanted a single equal operator in the last elseif() cond

Re: [PHP] if elseif elseif elseif....

2009-03-05 Thread chris smith
>>> $obligatoryFieldNotPresent=null; >>> >>> foreach($_POST, as $value) >>> { >>>        if(!empty($value)continue; >> >>     Parse error.  ;-P >> > There should be no comma there. That fixes one, what about the rest? ;) -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General

Re: [PHP] if elseif elseif elseif....

2009-03-05 Thread leledumbo
Daniel Brown-7 wrote: > > On Wed, Mar 4, 2009 at 20:10, Al wrote: >> >> $obligatoryFieldNotPresent=null; >> >> foreach($_POST, as $value) >> { >>if(!empty($value)continue; > > Parse error. ;-P > There should be no comma there. See http://id2.php.net/manual/en/control-structures.

Re: [PHP] if elseif elseif elseif....

2009-03-04 Thread Daniel Brown
On Wed, Mar 4, 2009 at 20:10, Al wrote: > > $obligatoryFieldNotPresent=null; > > foreach($_POST, as $value) > { >        if(!empty($value)continue; Parse error. ;-P -- daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hos

Re: [PHP] if elseif elseif elseif....

2009-03-04 Thread Chris
finally found the problem... wrong names for string and this is what now verifies correctly if (strlen($_POST["titleIN"]) == 0 ) { $obligatoryFieldNotPresent = 1; } elseif (strlen($_POST["first_nameIN"]) == 0 ) { $obligatoryFieldNotPresent = 1; } elsei

Re: [PHP] if elseif elseif elseif....

2009-03-04 Thread Al
PJ wrote: PJ wrote: Daniel Brown wrote: On Wed, Mar 4, 2009 at 17:51, PJ wrote: elseif ($obligatoryFieldNotPresent = 1) { $obligatoryFieldNotPresent = 0; } Are you certain you only wanted a single equal operator in the last elseif() condition? F

Re: [PHP] if elseif elseif elseif....

2009-03-04 Thread Shawn McKenzie
PJ wrote: > PJ wrote: >> Daniel Brown wrote: >> >>> On Wed, Mar 4, 2009 at 17:51, PJ wrote: >>> >>> >>> elseif ($obligatoryFieldNotPresent = 1) { $obligatoryFieldNotPresent = 0; } >>> Are you certain you only wanted a single equal operator in the >>> last elseif() condi

Re: [PHP] if elseif elseif elseif....

2009-03-04 Thread Chris
Shawn McKenzie wrote: Chris wrote: PJ wrote: Daniel Brown wrote: On Wed, Mar 4, 2009 at 17:51, PJ wrote: elseif ($obligatoryFieldNotPresent = 1) { $obligatoryFieldNotPresent = 0; } Are you certain you only wanted a single equal operator in the last elseif() condi

Re: [PHP] if elseif elseif elseif....

2009-03-04 Thread PJ
PJ wrote: > Daniel Brown wrote: > >> On Wed, Mar 4, 2009 at 17:51, PJ wrote: >> >> >>>elseif ($obligatoryFieldNotPresent = 1) { >>>$obligatoryFieldNotPresent = 0; >>>} >>> >>> >> Are you certain you only wanted a single equal operator in the >> last e

Re: [PHP] if elseif elseif elseif....

2009-03-04 Thread Shawn McKenzie
Chris wrote: > PJ wrote: >> Daniel Brown wrote: >>> On Wed, Mar 4, 2009 at 17:51, PJ wrote: >>> elseif ($obligatoryFieldNotPresent = 1) { $obligatoryFieldNotPresent = 0; } >>> Are you certain you only wanted a single equal operator in the >>> last el

Re: [PHP] if elseif elseif elseif....

2009-03-04 Thread Chris
PJ wrote: Daniel Brown wrote: On Wed, Mar 4, 2009 at 17:51, PJ wrote: elseif ($obligatoryFieldNotPresent = 1) { $obligatoryFieldNotPresent = 0; } Are you certain you only wanted a single equal operator in the last elseif() condition? Further, are you sure it shou

Re: [PHP] if elseif elseif elseif....

2009-03-04 Thread PJ
Daniel Brown wrote: > On Wed, Mar 4, 2009 at 17:51, PJ wrote: > >>elseif ($obligatoryFieldNotPresent = 1) { >>$obligatoryFieldNotPresent = 0; >>} >> > > Are you certain you only wanted a single equal operator in the > last elseif() condition? Further, are you sure

Re: [PHP] if elseif elseif elseif....

2009-03-04 Thread Daniel Brown
On Wed, Mar 4, 2009 at 17:51, PJ wrote: >    elseif ($obligatoryFieldNotPresent = 1) { >            $obligatoryFieldNotPresent = 0; >    } Are you certain you only wanted a single equal operator in the last elseif() condition? Further, are you sure it should even be an elseif() and not a str

[PHP] if elseif elseif elseif....

2009-03-04 Thread PJ
This is probably a mysql question, but their list is rather dull - I think they don't appreciate my humor. Beside this list is fun ... and informative. Anyway, I can't figure this out. I am trying to verify inputs on a form and even if I have all the required fields right, I still get the error tha

[PHP] If I make a mistake logging in, the error shows again even if I enter the right values

2009-01-03 Thread Fred Silsbee
my PHP programs are working great to access Oracle 11g1 and MySQL 5.1 I entered a bad value for user name /passwordand got a message Could not connect: Access denied for user 'landon'@'localhost' (using password: YES) I restarted the script under Firefox 3.0.5 and got the same error message wi

Re: [PHP] If Column Exists

2008-08-17 Thread Luke
There is IF EXISTS for tables, is there the same thing for columns in the table like IF EXISTS column IN TABLE table ? Just an idea 2008/8/13 VamVan <[EMAIL PROTECTED]> > Interesting. Thanks guys!! > > On Wed, Aug 13, 2008 at 1:32 AM, Robin Vickery <[EMAIL PROTECTED]> wrote: > > > 2008/8/12 Vam

Re: [PHP] If Column Exists

2008-08-13 Thread VamVan
Interesting. Thanks guys!! On Wed, Aug 13, 2008 at 1:32 AM, Robin Vickery <[EMAIL PROTECTED]> wrote: > 2008/8/12 VamVan <[EMAIL PROTECTED]>: > > Hello, > > > > I am working on data migration for one mysql db to another using PHP. How > do > > I check if a particular table has a particular column.

Re: [PHP] If Column Exists

2008-08-13 Thread Robin Vickery
2008/8/12 VamVan <[EMAIL PROTECTED]>: > Hello, > > I am working on data migration for one mysql db to another using PHP. How do > I check if a particular table has a particular column. If not alter... > > Thanks > Use the information_schema: SELECT COUNT(*) AS column_exists FROM information_schem

RE: [PHP] If Column Exists

2008-08-13 Thread Per Jessen
Jay Blanchard wrote: > [snip] > I am working on data migration for one mysql db to another using PHP. > How do > I check if a particular table has a particular column. If not alter... > [/snip] > > Use DESCRIBE TABLE; > Then you'd have to parse the output - how about SELECT FROM LIMIT 1 ?

RE: [PHP] If Column Exists

2008-08-12 Thread Jay Blanchard
[snip] I am working on data migration for one mysql db to another using PHP. How do I check if a particular table has a particular column. If not alter... [/snip] Use DESCRIBE TABLE; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] If Column Exists

2008-08-12 Thread VamVan
Hello, I am working on data migration for one mysql db to another using PHP. How do I check if a particular table has a particular column. If not alter... Thanks

Re: [PHP] if

2008-01-24 Thread Richard Lynch
On Thu, January 24, 2008 9:39 am, Pastor Steve wrote: > Greetings, > > Can anyone point me in the right direction on this? > > I want a link to an image that appears below the link after it is > clicked. I > think it would be an ³if² statement, but I am not sure where to start. What you describe

Re: [PHP] if

2008-01-24 Thread Nathan Nobbe
On Jan 24, 2008 10:39 AM, Pastor Steve <[EMAIL PROTECTED]> wrote: > Greetings, > > Can anyone point me in the right direction on this? > > I want a link to an image that appears below the link after it is clicked. > I > think it would be an ³if² statement, but I am not sure where to start. there

[PHP] if

2008-01-24 Thread Pastor Steve
Greetings, Can anyone point me in the right direction on this? I want a link to an image that appears below the link after it is clicked. I think it would be an ³if² statement, but I am not sure where to start. Thanks, -- Steve M.

Re: [PHP] IF command

2007-10-19 Thread Bill Allaire
On Oct 18, 2007, at 9:50 PM, Bastien Koert wrote: Are you sure that the value is a string? If its numeric, then try the check without the quotes around the value http://www.php.net/manual/en/language.operators.comparison.php "If you compare an integer with a string, the string is convert

Re: [PHP] IF statement

2007-10-18 Thread Simon
I'd suggest a tutorial or something on BOOLEAN or LOGICAL OPERATORS. For example: true and false = false true or false = true not true and not false = false not true or not false = true and so on... The IF statement will simply take the result of a logical operation, and the result will either be

Re: [PHP] IF command

2007-10-18 Thread Casey
if (!in_array($component_reference, array(5,17))) // ... More compact. On Oct 18, 2007, at 5:49 PM, "ron.php" <[EMAIL PROTECTED]> wrote: When $component_reference is 5 or 19 I don't want the echo statement to output to the screen. What is the correct syntax? What I have below isn't w

RE: [PHP] IF command

2007-10-18 Thread Bastien Koert
Are you sure that the value is a string? If its numeric, then try the check without the quotes around the value bastien> From: [EMAIL PROTECTED]> To: php-general@lists.php.net> Date: Thu, 18 Oct 2007 19:49:55 -0500> Subject: [PHP] IF command> > When $component_reference

Re: [PHP] IF statement

2007-10-18 Thread Robert Cummings
On Thu, 2007-10-18 at 19:57 -0500, ron.php wrote: > I just tried to send this to the list. I am not trying make it post again, I > don't think I had the e-mail address correct the first time. > > I am trying to stop $component_reference from doing the echo below when the > value is 5 or 19. I

  1   2   3   4   5   6   7   8   >