Re: broken code....
| From: | Jochem Maas | Date: | Fri, 09 Dec 2005 15:14:38 +0000 |
| Subject: | Re: broken code.... | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-227201@lists.php.net to get a copy of this message | ||
Ben Blay wrote:
I believe the difference between using =& and = is that the former passes the value by reference, though I've never been clear about the benefits of using one over the other when it comes to PEAR:DB (the PEAR:DB documentation uses =& extensively, so presumably it is the better method).if you don't pass objects around by reference then you are actually creating a copy every time you assign it to a different variable or pass it to a function - normally when you use objects you want all code that uses an object to be talking to the same object and not copies thereof.
Ben On 12/8/05, Mark Steudel <mark@netriver.net> wrote:Good catch: So I normally do $results =& $db->query ( "SELECT * FROM table" ); What is the difference between using the & and not using the &. -----Original Message----- From: Ben Blay [mailto:benblay@gmail.com] Sent: Thursday, December 08, 2005 10:27 AM To: php-general@lists.php.net Subject: Re: [PHP] broken code....$results->query('select * from eternityrecords.journal');Should this not be: $results = $db->query('select * from eternityrecords.journal'); See: http://pear.php.net/manual/en/package.database.db.db-result.fetchinto.php Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php