Re: Re: [PHP] Multiple SQLite statements

2011-10-11 Thread Tim Streater
On 11 Oct 2011 at 03:03, Paul M Foster pa...@quillandmouse.com wrote: On Mon, Oct 10, 2011 at 04:14:00PM +0100, Tim Streater wrote: I would like to use the SQLite3 (not PDO) interface to SQLite, and I would like to be able to supply a string containing several SQL statements and have them

Re: Re: [PHP] Multiple SQLite statements

2011-10-11 Thread David Robley
Tim Streater wrote: On 11 Oct 2011 at 03:03, Paul M Foster pa...@quillandmouse.com wrote: On Mon, Oct 10, 2011 at 04:14:00PM +0100, Tim Streater wrote: I would like to use the SQLite3 (not PDO) interface to SQLite, and I would like to be able to supply a string containing several SQL

Re: Re: Re: [PHP] Multiple SQLite statements

2011-10-11 Thread Tim Streater
On 11 Oct 2011 at 10:47, David Robley robl...@aapt.net.au wrote: Tim Streater wrote: On 11 Oct 2011 at 03:03, Paul M Foster pa...@quillandmouse.com wrote: On Mon, Oct 10, 2011 at 04:14:00PM +0100, Tim Streater wrote: I would like to use the SQLite3 (not PDO) interface to SQLite, and I

Re: Re: Re: [PHP] Multiple SQLite statements

2011-10-11 Thread David Robley
Tim Streater wrote: On 11 Oct 2011 at 10:47, David Robley robl...@aapt.net.au wrote: Tim Streater wrote: On 11 Oct 2011 at 03:03, Paul M Foster pa...@quillandmouse.com wrote: On Mon, Oct 10, 2011 at 04:14:00PM +0100, Tim Streater wrote: I would like to use the SQLite3 (not PDO)

Re: Re: Re: Re: [PHP] Multiple SQLite statements

2011-10-11 Thread Tim Streater
On 11 Oct 2011 at 11:25, David Robley robl...@aapt.net.au wrote: Tim Streater wrote: On 11 Oct 2011 at 10:47, David Robley robl...@aapt.net.au wrote: Tim Streater wrote: On 11 Oct 2011 at 03:03, Paul M Foster pa...@quillandmouse.com wrote: On Mon, Oct 10, 2011 at 04:14:00PM +0100, Tim

[PHP] Multiple SQLite statements

2011-10-10 Thread Tim Streater
I would like to use the SQLite3 (not PDO) interface to SQLite, and I would like to be able to supply a string containing several SQL statements and have them all executed, thus saving the overhead of several calls. It *appears* that this may be how it actually works, but I wondered if anyone

Re: [PHP] Multiple SQLite statements

2011-10-10 Thread Paul M Foster
On Mon, Oct 10, 2011 at 04:14:00PM +0100, Tim Streater wrote: I would like to use the SQLite3 (not PDO) interface to SQLite, and I would like to be able to supply a string containing several SQL statements and have them all executed, thus saving the overhead of several calls. It *appears*

Re: [PHP] Multiple return statements in a function.

2009-04-24 Thread Richard Heyes
Hi, your function could be condensed to this: function check($a) {    return is_array($a) ? true : false; } Or even better, this: function check($a) { return is_array($a); } Not that I'd imagine it makes a great deal of difference. -- Richard Heyes HTML5 graphing: RGraph

[PHP] Multiple return statements in a function.

2009-04-23 Thread Peter van der Does
I tend to put my return value in a variable and at the end of the function I have 1 return statement. I have seen others doing returns in the middle of the function. Example how I do it: function check($a) { $return=''; if ( is_array( $a ) ) { $return='Array'; } else { $return='Not

Re: [PHP] Multiple return statements in a function.

2009-04-23 Thread Per Jessen
Peter van der Does wrote: I tend to put my return value in a variable and at the end of the function I have 1 return statement. I have seen others doing returns in the middle of the function. Example how I do it: function check($a) { $return=''; if ( is_array( $a ) ) {

Re: [PHP] Multiple return statements in a function.

2009-04-23 Thread George Larson
On Thu, Apr 23, 2009 at 8:25 AM, Per Jessen p...@computer.org wrote: Peter van der Does wrote: I tend to put my return value in a variable and at the end of the function I have 1 return statement. I have seen others doing returns in the middle of the function. Example how I do it: function

Re: [PHP] Multiple return statements in a function.

2009-04-23 Thread Paul M Foster
On Thu, Apr 23, 2009 at 08:12:47AM -0400, Peter van der Does wrote: I tend to put my return value in a variable and at the end of the function I have 1 return statement. I have seen others doing returns in the middle of the function. Example how I do it: function check($a) { $return='';

Re: [PHP] Multiple return statements in a function.

2009-04-23 Thread Tony Marston
tedd tedd.sperl...@gmail.com wrote in message news:p06240805c6161613a...@[192.168.1.101]... At 8:12 AM -0400 4/23/09, Peter van der Does wrote: I tend to put my return value in a variable and at the end of the function I have 1 return statement. I have seen others doing returns in the middle of

Re: [PHP] Multiple return statements in a function.

2009-04-23 Thread Per Jessen
George Larson wrote: That's an interesting subject that I've never considered. I usually return immediately. For me, it makes the code easier to read. I work with a number of other coders here and, if the result isn't returned then I have to keep reading through the code to make sure

Re: [PHP] Multiple return statements in a function.

2009-04-23 Thread tedd
At 8:12 AM -0400 4/23/09, Peter van der Does wrote: I tend to put my return value in a variable and at the end of the function I have 1 return statement. I have seen others doing returns in the middle of the function. -snip- What is your take? And is there any benefit to either method? Peter

Re: [PHP] Multiple return statements in a function.

2009-04-23 Thread Richard Heyes
Hi, while(true){ Yikes. Personally, I'd put the return value wherever it will make the code easier to read. If you're checking what has been passed as arguments, and one of them is wrong, I think there's little point in continuing, so an immediate return is the order of the day. Though with

Re: [PHP] Multiple return statements in a function.

2009-04-23 Thread Richard Quadling
2009/4/23 Tony Marston t...@marston-home.demon.co.uk: tedd tedd.sperl...@gmail.com wrote in message news:p06240805c6161613a...@[192.168.1.101]... At 8:12 AM -0400 4/23/09, Peter van der Does wrote: I tend to put my return value in a variable and at the end of the function I have 1 return

Re: [PHP] Multiple return statements in a function.

2009-04-23 Thread Per Jessen
Richard Heyes wrote: Hi, while(true){ Yikes. Personally, I'd put the return value wherever it will make the code easier to read. If you're checking what has been passed as arguments, and one of them is wrong, I think there's little point in continuing, so an immediate return is the

Re: [PHP] Multiple return statements in a function.

2009-04-23 Thread tedd
At 2:19 PM +0100 4/23/09, Tony Marston wrote: tedd tedd.sperl...@gmail.com wrote in message It's called Structured programming -- one way in and one way out of a function. There are, of course, exceptions where it might help others reviewing your code to see what's going on, such as

Re: [PHP] Multiple return statements in a function.

2009-04-23 Thread Robert Cummings
On Thu, 2009-04-23 at 10:14 -0400, tedd wrote: At 2:19 PM +0100 4/23/09, Tony Marston wrote: tedd tedd.sperl...@gmail.com wrote in message It's called Structured programming -- one way in and one way out of a function. There are, of course, exceptions where it might help others

Re: [PHP] Multiple return statements in a function.

2009-04-23 Thread Paul M Foster
On Thu, Apr 23, 2009 at 10:14:28AM -0400, tedd wrote: At 2:19 PM +0100 4/23/09, Tony Marston wrote: snip There is no such rule, it is a matter of personal preference. As a previous poster has already said, if you want to leave a function early and ignore all subsequent processing it is

Re: [PHP] Multiple return statements in a function.

2009-04-23 Thread tedd
At 10:25 AM -0400 4/23/09, Robert Cummings wrote: On Thu, 2009-04-23 at 10:14 -0400, tedd wrote: However, I am saying (after years of reading other people's code) it is generally much easier to read code that follows Structured Programming than it is to read code that doesn't. Actually I

Re: [PHP] Multiple if() statements

2006-06-30 Thread tedd
At 11:07 PM -0600 6/29/06, John Meyer wrote: Larry Garfield wrote: switch is fine if your elseif comparisons are equality based. If they're not equality based, then they don't map to switch as well. In other words, if you look at a logical ladder as the roots of the tree, as long as each root

Re: [PHP] Multiple if() statements

2006-06-30 Thread John Wells
On 6/30/06, tedd [EMAIL PROTECTED] wrote: At 11:07 PM -0600 6/29/06, John Meyer wrote: Larry Garfield wrote: switch is fine if your elseif comparisons are equality based. If they're not equality based, then they don't map to switch as well. Not true. I've come to really appreciate the

RE: [PHP] Multiple if() statements

2006-06-30 Thread Ford, Mike
On 30 June 2006 13:37, tedd wrote: At 11:07 PM -0600 6/29/06, John Meyer wrote: Larry Garfield wrote: switch is fine if your elseif comparisons are equality based. If they're not equality based, then they don't map to switch as well. In other words, if you look at a logical

Re: [PHP] Multiple if() statements

2006-06-30 Thread Richard Lynch
On Thu, June 29, 2006 11:07 pm, Larry Garfield wrote: switch is fine if your elseif comparisons are equality based. If they're not equality based, then they don't map to switch as well. Except in PHP which supports: switch(TRUE) { case _boolean_expression_: break; } So you can have case

RE: [PHP] Multiple if() statements

2006-06-30 Thread tedd
At 4:26 PM +0100 6/30/06, Ford, Mike wrote: On 30 June 2006 13:37, tedd wrote: At 11:07 PM -0600 6/29/06, John Meyer wrote: Larry Garfield wrote: [1] switch is fine if your elseif comparisons are equality based. If they're not equality based, then they don't map to switch as well.

RE: [PHP] Multiple if() statements

2006-06-29 Thread Ford, Mike
On 29 June 2006 01:03, David Tulloh wrote: I'm also going to throw in an elseif for fun, to get this (hopefully) improved version: if($row[1] == none) { print(tr); print(td$row[0] $row[2]/td); print(/tr); } elseif($row[1] == $row[2]) { print(tr); print(td$row[0]

Re: [PHP] Multiple if() statements

2006-06-29 Thread tedd
At 8:15 PM -0400 6/28/06, Robert Cummings wrote: On Wed, 2006-06-28 at 20:02, David Tulloh wrote: Grae Wolfe - PHP wrote: ... want. Any help would be great! -snip- if/elseif -snip- holy war id=opinion Whenever you need a elseif, then it's time to consider a switch -- like thus: print(

Re: [PHP] Multiple if() statements

2006-06-29 Thread Larry Garfield
On Thursday 29 June 2006 06:51, tedd wrote: At 8:15 PM -0400 6/28/06, Robert Cummings wrote: On Wed, 2006-06-28 at 20:02, David Tulloh wrote: Grae Wolfe - PHP wrote: ... want. Any help would be great! -snip- if/elseif -snip- holy war id=opinion Whenever you need a elseif,

Re: [PHP] Multiple if() statements

2006-06-29 Thread John Meyer
Larry Garfield wrote: switch is fine if your elseif comparisons are equality based. If they're not equality based, then they don't map to switch as well. In other words, if you look at a logical ladder as the roots of the tree, as long as each root has the same number of forks (say each

[PHP] Multiple if() statements

2006-06-28 Thread Grae Wolfe - PHP
I have a table with lots of fun information in it. For one of the pages that I am working on, I want to display a list of names based on what is in the DB. My $SQL statement works great and has pulled in values for first_name, hs_last_name, and last_name in that order. Right now, I am just

Re: [PHP] Multiple if() statements

2006-06-28 Thread David Tulloh
Grae Wolfe - PHP wrote: ... want. Any help would be great! if($row[1]=none) { print(tr); print(td$row[0] $row[2]/td); print(/tr); } else if($row[1]=$row[2]) { print(tr); print(td$row[0] $row[2]/td); print(/tr); } else print(tr); print(td$row[0]

Re: [PHP] Multiple if() statements

2006-06-28 Thread Robert Cummings
On Wed, 2006-06-28 at 20:02, David Tulloh wrote: Grae Wolfe - PHP wrote: ... want. Any help would be great! if($row[1]=none) { print(tr); print(td$row[0] $row[2]/td); print(/tr); } else if($row[1]=$row[2]) { print(tr); print(td$row[0] $row[2]/td);

Re: [PHP] Multiple if() statements

2006-06-28 Thread Paul Novitski
At 04:38 PM 6/28/2006, Grae Wolfe - PHP wrote: The first problem is men's names and unmarried women's names... they will have the same hs_last_name and last_name so I don't want the duplicate displaying on the page. The second problem is the entry of the word none by some of the visitors in