Well, I have a situation where an Order object holds a collection of LineItem objects and of course they all use the same DB connection via a singleton. The Order object has a method that creates new LineItem objects from an ORDER_DTL table. Code snippet: // SET ORDER ITEMS $stmt = $this->db->prepare($detailSQL); $stmt->execute(array(':orderid' => $orderID)); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $lineItem = new GCLineItem($row['item_id']); $lineItem->__set('quantity', $row['quantity']); $lineItem->__set('price', $row['price']); $this->items[] = $lineItem; } Within the while loop I am loading GCLineItem objects that themselves try to create a statement object which is where the error is triggered since both share the same DB connection and the statement objects trip over themselves. I get an SQL error HY090 Buffer error... My only solution was to let the GCLineItem objects create another DB connection for themselves. This is not ideal and is a hack in my opinion. I could run a fetchAll on the Order statement object and this would complete one statement object before each GCLineItem objects creates there own statement object - correct? I may have just answered my own question, but if you or anybody else can think of a better solution - I am all ears! Ken Vandegrift kvandegrift@xxxxxxxxxx Web Administrator Sharis Mgmt. Corp -----Original Message----- From: Chris [mailto:dmagick@xxxxxxxxx] Sent: Tuesday, July 18, 2006 5:32 PM To: Vandegrift, Ken Cc: php-db@xxxxxxxxxxxxx Subject: Re: Sigleton DB connection tripping on itself Vandegrift, Ken wrote: > Good Day List, > > I have a singleton DB connection that I am trying to use throughout my > application but It keeps tripping on itself. > > My main question is: If I am in the middle of a transaction can I > prepare multiple statements eand execute them or will this cause an > error? There's no reason why it can't. However, if any of those queries fail the whole transaction will get rolled back. What errors are you getting? -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php