RE: [PHP] ! and !=

2009-04-23 Thread Ford, Mike
On 23 April 2009 01:05, George Langley advised: Doh, of course! Just not thinking about the scope of the operator. If $var1 = 1, then !$var1 = 0 Thanks everyone! Well, actually, to be strictly accurate, since ! is a Boolean operator, if $var1 = 1 then !$var1 = FALSE. Cheers!

[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] Unable to send mail from PHP to ATT e-mail address

2009-04-23 Thread Bob McConnell
From: Chris Any light anyone can throw on the 'nob...@myserver.com' address would be most welcome. It is using the apache user @ your host name as the default. Try this: ini_set('sendmail_from', 'whate...@wherever.com'); I will try this but I do not understand why it should work. I have

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] checkboxes

2009-04-23 Thread tedd
At 5:33 PM -0400 4/22/09, PJ wrote: Well, I'm making a page to do limited searching of the database. To keep it simple I just want to search by title, author, ISBN or copyright date. So, I need to input the user's choice, limit it to one of the options and pass the supplied parameter to the

[PHP] MySQL -- finding whether there's a transaction started

2009-04-23 Thread Bogdan Stancescu
Hello list, I'm developing a library and would need to know if the code calling my library has already started a MySQL transaction or not. I want to know whether I should start one or use savepoints instead -- starting a transaction if one is already in progress commits the existing transaction,

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] Suggestions of some good, simple file upload 'in progress' code?

2009-04-23 Thread tedd
At 1:46 PM -0600 4/22/09, scubak1w1 wrote: I am thinking that is where I am at... as you said, the user just needs to know that there computer is busy, hang on a second already! grin I like those icons - if I may be so bold though, and excuse the broadness of the question, are you / can you

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] checkboxes

2009-04-23 Thread PJ
tedd wrote: At 5:33 PM -0400 4/22/09, PJ wrote: Well, I'm making a page to do limited searching of the database. To keep it simple I just want to search by title, author, ISBN or copyright date. So, I need to input the user's choice, limit it to one of the options and pass the supplied

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] checkboxes

2009-04-23 Thread tedd
At 10:11 AM -0400 4/23/09, PJ wrote: tedd wrote: http://php1.net/a/edit-db-demo/ Here a user can search for a Last name, first name, or email. Note, there's no checkboxes because the user indicates what they are searching for by where they place their search criteria. HTH's tedd

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

[PHP] unzip a file - destination folder wrong

2009-04-23 Thread Merlin Morgenstern
Hi there, I am trying to unzip a zip file. Therefore I am using this function: # unzip a file function extract_zipfile($filename){ $zip = zip_open($filename); if ($zip) { while ($zip_entry = zip_read($zip)) { $fp = fopen(zip_entry_name($zip_entry), w);

[PHP] Re: unzip a file - destination folder wrong

2009-04-23 Thread Shawn McKenzie
Merlin Morgenstern wrote: Hi there, I am trying to unzip a zip file. Therefore I am using this function: # unzip a file function extract_zipfile($filename){ $zip = zip_open($filename); if ($zip) { while ($zip_entry = zip_read($zip)) { $fp =

[PHP] Re: unzip a file - destination folder wrong

2009-04-23 Thread Merlin Morgenstern
Shawn McKenzie wrote: Merlin Morgenstern wrote: Hi there, I am trying to unzip a zip file. Therefore I am using this function: # unzip a file function extract_zipfile($filename){ $zip = zip_open($filename); if ($zip) { while ($zip_entry = zip_read($zip)) { $fp =

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

[PHP] How can I detect an exception without using try/catch?

2009-04-23 Thread Bill Moran
Specifically, the __destruct() method of certain objects will be called if an object goes out of scope due to an exception. Since the __destruct() method didn't call the code that caused the exception, it can't catch it. I need the __destruct() method to behave differently if it's called while

Re: [PHP] checkboxes

2009-04-23 Thread PJ
tedd wrote: At 10:11 AM -0400 4/23/09, PJ wrote: tedd wrote: http://php1.net/a/edit-db-demo/ Here a user can search for a Last name, first name, or email. Note, there's no checkboxes because the user indicates what they are searching for by where they place their search criteria.

Re: [PHP] @$_POST[...]

2009-04-23 Thread PJ
Chris wrote: Luke wrote: 2009/4/22 PJ af.gour...@videotron.ca Could somebody explain to me the meaning of @ in $var = @$_POST['title'] ; where could I find a cheat sheet for those kinds of symbols or what are they called? Sorry for my ignorance, but maybe this will take the fog filter our

Re: [PHP] bug or expected, mbstring.func_overload not changeable by .htaccess 5.2.8/5.2.9

2009-04-23 Thread Thodoris
Hello, Besides the .htaccess which might be an apache configuration problem if you use ini_set(mbstring.func_overload,2) in a script of this directory does it work? no, also the ini_set does not work for this Directive. Sorry for the late reply. The ini_set is meant to be used inside a

[PHP] ReflectionMethod::invokeArgs

2009-04-23 Thread K. L.
Hi! Please, tell me what's ReflectionMethod::invokeArgs first param for? Since method always know it's class and it can only be invoked on it's own class. Regards, K.L. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: unzip a file - destination folder wrong

2009-04-23 Thread Shawn McKenzie
Merlin Morgenstern wrote: Shawn McKenzie wrote: Merlin Morgenstern wrote: Hi there, I am trying to unzip a zip file. Therefore I am using this function: # unzip a file function extract_zipfile($filename){ $zip = zip_open($filename); if ($zip) { while ($zip_entry =

[PHP] Symlinks and ownership

2009-04-23 Thread Christoph Boget
Is there a reason why you can't programatically set ownership of a symbolic ink? The following code if( symlink( TARGET, LINK )) { echo 'Successfully created ' . LINK . \n; if( @chown( LINK, NEW_UID )) { echo 'Successfully changed ownership for ' . LINK . \n; if( @chgrp( LINK,

Re: [PHP] Re: unzip a file - destination folder wrong

2009-04-23 Thread 9el
snip $fp = fopen(dirname($filename) . '/' . zip_entry_name($zip_entry), w); thank you this worked. How come the . '/' . zip_entry_name($zip_entry) is needed? Looks like a double file name, but the result is ok. Could you explain this line? /snip read carefully, you'll understand too. :)

Re: [PHP] Symlinks and ownership

2009-04-23 Thread Daniel Brown
On Thu, Apr 23, 2009 at 13:21, Christoph Boget christoph.bo...@gmail.com wrote: Is there a reason why you can't programatically set ownership of a symbolic ink?  The following code You can't do it from the command line either, Chris. This is because chown and chgrp automatically

[PHP] Extract variable out of a Class - Function

2009-04-23 Thread Rahul S. Johari
I have a function within a class. There is a variable inside that function which I need to access use outside of the class/function. For example ... Class Test { function showOutput { if ($this-url) { $justTT = substr($this-url,-10,7);

Re: [PHP] Extract variable out of a Class - Function

2009-04-23 Thread Alex S Kurilo aka Kamazee
I have a function within a class. There is a variable inside that function which I need to access use outside of the class/function. For example ... Class Test { function showOutput { if ($this-url) { $justTT = substr($this-url,-10,7);

[PHP] how to determine if a mysql query returns an empty set?

2009-04-23 Thread Adam Williams
Is there a way to determine if a mysql query returns an empty set? I am selecting 10 results at a time with a limit statement and need to know when i've ran out of rows. I've only got 2 rows in the database, so when I start with row 10, it returns an empty set. I have the following code:

Re: RES: [PHP] Extract variable out of a Class - Function

2009-04-23 Thread Rahul S. Johari
Yes!!! It works!! Thats' exactly what I was looking for ... getting the value of $justTT in $othervar. I'm new to classes ... thus the noobity! On Apr 23, 2009, at 2:04 PM, Jônatas Zechim wrote: Class Test { function showOutput { if ($this-url) {

Re: [PHP] how to determine if a mysql query returns an empty set?

2009-04-23 Thread Nitsan Bin-Nun
mysql_num_rows() maybe? if not I probably haven't understood your question. On Thu, Apr 23, 2009 at 8:12 PM, Adam Williams awill...@mdah.state.ms.uswrote: Is there a way to determine if a mysql query returns an empty set? I am selecting 10 results at a time with a limit statement and need to

Re: [PHP] how to determine if a mysql query returns an empty set?

2009-04-23 Thread Andrew Ballard
On Thu, Apr 23, 2009 at 2:12 PM, Adam Williams awill...@mdah.state.ms.us wrote: Is there a way to determine if a mysql query returns an empty set?  I am selecting 10 results at a time with a limit statement and need to know when i've ran out of rows.  I've only got 2 rows in the database, so

Re: [PHP] how to determine if a mysql query returns an empty set?

2009-04-23 Thread Adam Williams
Nitsan Bin-Nun wrote: mysql_num_rows() maybe? if not I probably haven't understood your question. Thanks, I never thought of trying that. This code works! $mysqli_get_requests = mysqli_query($mysqli,$get_requests); if (!mysqli_num_rows($mysqli_get_requests))

Re: [PHP] how to determine if a mysql query returns an empty set?

2009-04-23 Thread Adam Williams
Andrew Ballard wrote: It won't be any of those because the query is successful even if it returns no records. You could use http://us2.php.net/manual/en/mysqli-stmt.num-rows.php to determine how many rows were returned. Andrew Oh ok, thanks that makes sense. Thanks for the link also --

Re: [PHP] bug or expected, mbstring.func_overload not changeable by .htaccess 5.2.8/5.2.9

2009-04-23 Thread Andre Hübner
Hello, Sorry for the late reply. no problem. The ini_set is meant to be used inside a php script not in an .htaccess file. So perhaps you could test this in a script specific manner. i know;) i do php/apache for some years... i found out the problem in meanwhile.

Re: [PHP] checkboxes

2009-04-23 Thread PJ
PJ wrote: tedd wrote: At 10:11 AM -0400 4/23/09, PJ wrote: tedd wrote: http://php1.net/a/edit-db-demo/ Here a user can search for a Last name, first name, or email. Note, there's no checkboxes because the user indicates what they are searching for by where they place

Re: [PHP] checkboxes

2009-04-23 Thread PJ
PJ wrote: tedd wrote: At 10:11 AM -0400 4/23/09, PJ wrote: tedd wrote: http://php1.net/a/edit-db-demo/ Here a user can search for a Last name, first name, or email. Note, there's no checkboxes because the user indicates what they are searching for by where they place

Re: [PHP] checkboxes

2009-04-23 Thread tedd
At 4:58 PM -0400 4/23/09, PJ wrote: tedd wrote: http://php1.net/a/edit-db-demo/ H I've looked at your demo and, frankly, don't see it working. When I enter names and click on one of the search buttons, I don't get sane results. For instance, entering Johnson in last name and

Re: [PHP] checkboxes

2009-04-23 Thread Lists
tedd wrote: At 4:58 PM -0400 4/23/09, PJ wrote: tedd wrote: http://php1.net/a/edit-db-demo/ H I've looked at your demo and, frankly, don't see it working. When I enter names and click on one of the search buttons, I don't get sane results. For instance, entering Johnson in

Re: [PHP] Unable to send mail from PHP to ATT e-mail address

2009-04-23 Thread Chris
the ini_set (or you can set the 5th param to the mail() function) is a return-path. If the message bounces (recipient's mailbox full, server down, whatever the reason) it gets delivered to that address. They serve different purposes. The dirty little secret that nobody seems to know is

Re: [PHP] MySQL -- finding whether there's a transaction started

2009-04-23 Thread Chris
Bogdan Stancescu wrote: Hello list, I'm developing a library and would need to know if the code calling my library has already started a MySQL transaction or not. I want to know whether I should start one or use savepoints instead -- starting a transaction if one is already in progress commits

[PHP] Re: Encrypting email

2009-04-23 Thread Ross McKay
On Tue, 21 Apr 2009 08:39:25 -0400, Bob McConnell wrote: I have been asked by a product manager what our options are for encrypting email messages with sensitive information. We are currently using PHPMailer to send email. What can be done to encrypt those messages? Can it be done without OOP?

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

2009-04-23 Thread Brad Broerman
Well, the latter method is generally easier to understand later. Most programming style books preach this method, and it's the one that most of my previous employers use. Cheers... -Original Message- From: Peter van der Does [mailto:pvanderd...@gmail.com] Sent: Thursday, April 23, 2009