3 Replies Latest reply on Nov 9, 2011 12:31 PM by kokorito

    Can Some One Help With A PHP Class?

    Jason Woodcock

      I have a simple function and I can not for the life of me get it to work properly. Here's the PHP:

       

       

      <?php

       

      class userProjectNotes {

       

       

                var $username = "user";

                var $password = "secret";

                var $server = "url-here.net";

                var $port = "3306";

                var $databasename = "mscoast";

       

       

                var $connection;

       

                public function __construct() {

                            $this->connection = mysqli_connect(

                                                                                        $this->server, 

                                                                                        $this->username, 

                                                                                        $this->password,

                                                                                        $this->databasename,

                                                                                        $this->port

                                                                              );

       

       

                          $this->throwExceptionOnError($this->connection);

                }

       

       

                /**

                 * Gets all my stuffs from the places... Yeah... You get it...

                 */

       

                public function getAlluserProjectnotes($userTable) {

       

       

                          $stmt = mysqli_prepare($this->connection, "SELECT * FROM $userTable");

                          $this->throwExceptionOnError();

       

                          mysqli_stmt_execute($stmt);

                          $this->throwExceptionOnError();

       

                          $rows = array();

       

                          mysqli_stmt_bind_result($stmt, $row->notes_id, $row->date_added, $row->note, $row->pid);

       

                    while (mysqli_stmt_fetch($stmt)) {

                      $rows[] = $row;

                      $row = new stdClass();

                      mysqli_stmt_bind_result($stmt, $row->notes_id, $row->date_added, $row->note, $row->pid);

                    }

       

                          mysqli_stmt_free_result($stmt);

                    mysqli_close($this->connection);

       

                    return $rows;

                }

       

      ?>

      ( I ommited the ThrowexceptionOnError to save space in this post.

       

      And here is my call to it:

       

       

      protected function list_creationCompleteHandler():void

                                    {

                                              userProjectNotes.endpoint = "http://www.url-here.net/app-resources/gateway.php";

                                              getAlluserProjectnotesResult.token = userProjectNotes.getAlluserProjectnotes(userNotesTable);

                                    }

       

       

      it works locally, but remotely I get:

       

       

      Channel disconnected before an acknowledgement was received