Skip navigation
CNKratos
Currently Being Moderated

A problem of Channel disconnected(Flex & PHP)

Aug 16, 2012 8:26 PM

Tags: #error #php #flex4.6 #database_connecting

Hi there,

I am also a rookie of Flex. Recently,I try to learn it with the Adobe’s tutorials which locals on:

First.JPG

http://www.adobe.com/cn/devnet/flex/testdrive/articles/2_modify_the_da tabase.html#links

However,when I attempt to add some employees as the tutorial

Second.JPG

says,there always be an error:

Channel disconnected

Channel disconnected before an acknowledgement was received

Even though I searched for the solution a lot times,I haven’t find a appropriate one.

It bothers me several days

So, if you guys knew how to figure it out , please do me a favor.

Thanx a lot

Nick

 
Replies
  • Currently Being Moderated
    Jan 1, 2013 8:08 AM   in reply to CNKratos

    SOLUTION:

     

    When you follow the TestDrive tutorial you assume that all the syntax is 100% OK. That is not the case here.

     

    If you try to use the functions createEmployee(), updateEmployee() or deleteEmployee() you will notice that it needs to bind the parameters to the $stmt variable. When the PHP service (in this case:  EmployeeService) is called and the function reaches the point where the binding is performed the PHP will return a PHP Fatal error (you may check on your PHP log - usualy in C:\xampp\php\logs\php_error_log)  informing that there is a Call to undefined function mysqli_bind_param().

     

    To solve this you must  change your code as described below:

     

          Let's assume we are working with the function createEmployee()

     

      public function createEmployee($item) {

         $stmt = mysqli_prepare($this->connection,

         "INSERT INTO employees (

         firstname,lastname,title,departmentid,officephone,cellphone,

         email,street,city,state,zipcode,office,photofile)

         VALUES (?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?)");

         $this->throwExceptionOnError();

     

     

    all the same until now... BUT, notice the very beggining of the next statement...

     

              $stmt->bind_param('sssisssssssss', $item->firstname, $item->lastname,

                        $item->title, $item->departmentid, $item->officephone, $item->cellphone,

                        $item->email, $item->street, $item->city, $item->state,

                        $item->zipcode, $item->office, $item->photofile);

     

    ------------------

     

    When you check the original code you will notice that the

           mysqli_bind_param($stmt, 

     

    was replaced by

           $stmt->bind_param(.

     

    This will solve the problem for good

     

    Best regards!

     

    Pitagoras

     

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 6, 2013 7:54 AM   in reply to Vixborn

    The issue is because mysqli_bind_param() function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.

     

    Source: http://php.net/manual/en/function.mysqli-bind-param.php

     

    Replacing that with mysqli_stmt_bind_param() works .

     

    Cheers,

    raghu

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 19, 2013 6:15 AM   in reply to Vixborn

    Amazingly helpful! Thank god people like you exist because you just helped me massively!

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points