3 Replies Latest reply on Aug 30, 2010 9:39 AM by maniChina

    Connect to Data/Service (PHP) problems should be fixed




      1.insert ByteArray into or select from mysql blob with PHP ERROR


      The default code is error, I couldn't insert ByteArray data into mysql till I add the mysqli_send_long_data() method.




      • $stmt = mysqli_prepare($this->connection, "INSERT INTO $this->tablename (info, info2) VALUES (?, ?)");
      • $this->throwExceptionOnError();

      • mysqli_stmt_bind_param($stmt, 'bs', $item->info, $item->info2);
      • $this->throwExceptionOnError();

      • mysqli_send_long_data($stmt, 0, $item->info);

      • mysqli_stmt_execute($stmt);





      And add $stmt->store_result(); when you get blob data:



      • mysqli_stmt_execute($stmt);
      • $stmt->store_result();
      • foreach($rows as $value){
               if($value->info){                    $value->info = new Zend_Amf_Value_ByteArray($value->info);               }           }            reference:http://blogs.sun.com/oswald/entry/php_s_mysqli_extension_storing       

      2.Test Operation is ok, but use in application couldn't work.   I have to change the PHP function name to make it shown in flash builder color "gray" , and then it works.




      3.The auto created method like update... and delete... should be like below, return the affected num.



      • $affected = mysqli_stmt_affected_rows($stmt);
      • mysqli_stmt_free_result($stmt);
      • mysqli_close($this->connection);
      • return $affected;