connect(); $sql = "SELECT * FROM customers"; $result = mysql_query($sql) or die('Query failed: ' . mysql_error()); $counter = 0; $resultObj = null; if($result) { while(($row = mysql_fetch_assoc($result))) { $resultObj = $this->createCustomerObject($row); if($resultObj != null) { $response[$counter] = $resultObj; $counter++; } } } return $response; } private function createCustomerObject($row) { $customerObj = null; if($row) { $customerObj = new Customer(); $customerObj->customerId = intval($row["customer_id"]); $customerObj->customerName = $row["customer_name"]; $customerObj->customerType = $row["customer_type"]; $customerObj->customerAddress = $row["customer_address"]; $customerObj->entryModifiedDate = $row["entry_modified_date"]; } return $customerObj; } } ?>