Have checked out php error log at server side (error logging has been enabled) but it did not generate any error. (I am sure the error logging has been enabled because I intentionally edit the $databasename wrongly, I can trigger the php error log stating DB access denied)
So, even I put back everything in order (see below php code for the view service that is generated directly by flex builder 4.6), I still cannot retrieve data from the view service. This is a simple testing app and I have it also running from another web hosting service provider and runs perfectly see http://www.bbrchk.com/testdb/testdb.html But, for this same app running in another web hosting service provider, I got no view data retrieved, see http://www.bbrclubhk.com/testdb/testdb.html Please anybody help? Regards, David <?php /** * README for sample service * * This generated sample service contains functions that illustrate typical service operations. * Use these functions as a starting point for creating your own service implementation. Modify the * function signatures, references to the database, and implementation according to your needs. * Delete the functions that you do not use. * * Save your changes and return to Flash Builder. In Flash Builder Data/Services View, refresh * the service. Then drag service operations onto user interface components in Design View. For * example, drag the getAllItems() operation onto a DataGrid. * * This code is for prototyping only. * * Authenticate the user prior to allowing them to call these methods. You can find more * information at http://www.adobe.com/go/flex_security * */ class StaffviewpositionService { var $username = "bbrclubh_dwu"; var $password = "fakepassword"; var $server = "103.109.101.18"; var $port = "3306"; var $databasename = "bbrclubh_bookclub"; var $tablename = "staffviewposition"; var $connection; /** * The constructor initializes the connection to database. Everytime a request is * received by Zend AMF, an instance of the service class is created and then the * requested method is invoked. */ public function __construct() { $this->connection = mysqli_connect( $this->server, $this->username, $this->password, $this->databasename, $this->port ); $this->throwExceptionOnError($this->connection); } /** * Returns all the rows from the table. * * Add authroization or any logical checks for secure access to your data * * @return array */ public function getAllStaffviewposition() { $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename"); $this->throwExceptionOnError(); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); $rows = array(); mysqli_stmt_bind_result($stmt, $row->iddStaff, $row->txtLastName, $row->txtFirstName, $row->iddPosition, $row->txtPosition); while (mysqli_stmt_fetch($stmt)) { $rows[] = $row; $row = new stdClass(); mysqli_stmt_bind_result($stmt, $row->iddStaff, $row->txtLastName, $row->txtFirstName, $row->iddPosition, $row->txtPosition); } mysqli_stmt_free_result($stmt); mysqli_close($this->connection); return $rows; } /** * Returns the item corresponding to the value specified for the primary key. * * Add authorization or any logical checks for secure access to your data * * * @return stdClass */ public function getStaffviewpositionByID($itemID) { $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename where iddStaff=?"); $this->throwExceptionOnError(); mysqli_stmt_bind_param($stmt, 'i', $itemID); $this->throwExceptionOnError(); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); mysqli_stmt_bind_result($stmt, $row->iddStaff, $row->txtLastName, $row->txtFirstName, $row->iddPosition, $row->txtPosition); if(mysqli_stmt_fetch($stmt)) { return $row; } else { return null; } } /** * Returns the item corresponding to the value specified for the primary key. * * Add authorization or any logical checks for secure access to your data * * * @return stdClass */ public function createStaffviewposition($item) { $stmt = mysqli_prepare($this->connection, "INSERT INTO $this->tablename (iddStaff, txtLastName, txtFirstName, iddPosition, txtPosition) VALUES (?, ?, ?, ?, ?)"); $this->throwExceptionOnError(); mysqli_stmt_bind_param($stmt, 'issis', $item->iddStaff, $item->txtLastName, $item->txtFirstName, $item->iddPosition, $item->txtPosition); $this->throwExceptionOnError(); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); $autoid = mysqli_stmt_insert_id($stmt); mysqli_stmt_free_result($stmt); mysqli_close($this->connection); return $autoid; } /** * Updates the passed item in the table. * * Add authorization or any logical checks for secure access to your data * * @param stdClass $item * @return void */ public function updateStaffviewposition($item) { $stmt = mysqli_prepare($this->connection, "UPDATE $this->tablename SET iddStaff=?, txtLastName=?, txtFirstName=?, iddPosition=?, txtPosition=? WHERE iddStaff=?"); $this->throwExceptionOnError(); mysqli_stmt_bind_param($stmt, 'issisi', $item->iddStaff, $item->txtLastName, $item->txtFirstName, $item->iddPosition, $item->txtPosition, $item->iddStaff); $this->throwExceptionOnError(); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); mysqli_stmt_free_result($stmt); mysqli_close($this->connection); } /** * Deletes the item corresponding to the passed primary key value from * the table. * * Add authorization or any logical checks for secure access to your data * * * @return void */ public function deleteStaffviewposition($itemID) { $stmt = mysqli_prepare($this->connection, "DELETE FROM $this->tablename WHERE iddStaff = ?"); $this->throwExceptionOnError(); mysqli_stmt_bind_param($stmt, 'i', $itemID); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); mysqli_stmt_free_result($stmt); mysqli_close($this->connection); } /** * Returns the number of rows in the table. * * Add authorization or any logical checks for secure access to your data * * */ public function count() { $stmt = mysqli_prepare($this->connection, "SELECT COUNT(*) AS COUNT FROM $this->tablename"); $this->throwExceptionOnError(); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); mysqli_stmt_bind_result($stmt, $rec_count); $this->throwExceptionOnError(); mysqli_stmt_fetch($stmt); $this->throwExceptionOnError(); mysqli_stmt_free_result($stmt); mysqli_close($this->connection); return $rec_count; } /** * Returns $numItems rows starting from the $startIndex row from the * table. * * Add authorization or any logical checks for secure access to your data * * * * @return array */ public function getStaffviewposition_paged($startIndex, $numItems) { $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename LIMIT ?, ?"); $this->throwExceptionOnError(); mysqli_stmt_bind_param($stmt, 'ii', $startIndex, $numItems); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); $rows = array(); mysqli_stmt_bind_result($stmt, $row->iddStaff, $row->txtLastName, $row->txtFirstName, $row->iddPosition, $row->txtPosition); while (mysqli_stmt_fetch($stmt)) { $rows[] = $row; $row = new stdClass(); mysqli_stmt_bind_result($stmt, $row->iddStaff, $row->txtLastName, $row->txtFirstName, $row->iddPosition, $row->txtPosition); } mysqli_stmt_free_result($stmt); mysqli_close($this->connection); return $rows; } /** * Utility function to throw an exception if an error occurs * while running a mysql command. */ private function throwExceptionOnError($link = null) { if($link == null) { $link = $this->connection; } if(mysqli_error($link)) { $msg = mysqli_errno($link) . ": " . mysqli_error($link); throw new Exception('MySQL Error - '. $msg); } } } ?> -- Sent from: http://apache-flex-users.2333346.n4.nabble.com/