This error happens when

1-you have an echo or print statement in your service php file.(the php file under services directory)

2-happens when you do not set the port to 3306 explicitly. If you leave the port blank, i.e, port=””, this works in Flex, but not on the server.

3-happens when you set server anything other than localhost. So, do that, $server = “localhost”; . There are good reasons for this, but i cannot elaborate right now.

In general, download a network monitoring application like charles and see what your php returns. Flex only tells that the channel is disconnected, but actually the error can be thousand things. Mostly it is “Can’t connect to MySQL server on server“.

Edit:there is another reason. Depending on a condition, if you return a variable to flex, make sure that the variable is created before the condition. For example;

while($row = mysql_fetch_array(result)){
 return $rows;

results in an error if there is no row to fetch, because $rows is undefined and cannot be returned. The correct code is this ;

 $rows = array();
 while($row = mysql_fetch_array(result)){
} return $rows;

happy coding