Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Adobe Flex到数据库的插入、更新?_Php_Apache Flex_Zend Framework_Amfphp - Fatal编程技术网

Php Adobe Flex到数据库的插入、更新?

Php Adobe Flex到数据库的插入、更新?,php,apache-flex,zend-framework,amfphp,Php,Apache Flex,Zend Framework,Amfphp,我很难通过zend php将flex连接到MySql。我看到了几个使用HTTP服务的示例。我的问题如下 1) 我只做了一个简单的插入和更新,只有三个表。那么我应该使用所有这些Zend AMF来实现这一点吗? 2) 还有,使用HTTPService呢 使用zend AMF显示是最简单的操作,但当我尝试插入值时,我丢失了 我想要一个php文件vo.php来存储数据库字段变量,但我不能在主php文件中使用require_once函数 这是vo.php class vo { p

我很难通过zend php将flex连接到MySql。我看到了几个使用HTTP服务的示例。我的问题如下

1) 我只做了一个简单的插入和更新,只有三个表。那么我应该使用所有这些Zend AMF来实现这一点吗? 2) 还有,使用HTTPService呢

使用zend AMF显示是最简单的操作,但当我尝试插入值时,我丢失了

我想要一个php文件vo.php来存储数据库字段变量,但我不能在主php文件中使用require_once函数

这是vo.php

    class vo {

        public $id;
        public $username;
        public $symptom;
        public $number_of_times_tested;
        public $original_image;
        public $sequence_of_actions;
        public $customized_image;
        public $percieved_image;
    }
这是patientService文件

//require_once 'vo.php';

class patientService { 
  var $username = "root"; 
  var $password = ""; 
  var $server = "localhost"; 
  var $port = "3306"; 
  var $databasename = "patient"; 
  var $tablename = "records"; 

  var $connection; 
  public function __construct() { 
    $this->connection = mysqli_connect( 
                       $this->server,  
                       $this->username,  
                       $this->password, 
                       $this->databasename, 
                       $this->port); 

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

  public function getpatient() {
     $stmt = mysqli_prepare($this->connection,
          "SELECT
              records.id,
              records.username,
              records.symptom,
              records.number_of_times_tested,
              records.original_image,
              records.sequence_of_actions,
              records.customized_image,
              records.percieved_image
            FROM records");     

      $this->throwExceptionOnError();

      mysqli_stmt_execute($stmt);
      $this->throwExceptionOnError();

      $rows = array();
      mysqli_stmt_bind_result($stmt, $row->id, $row->username,
                    $row->symptom, $row->number_of_times_tested, $row->original_image,  $row->sequence_of_actions, $row->customized_image, $row->percieved_image
                    );

      while (mysqli_stmt_fetch($stmt)) {
          $rows[] = $row;
          $row = new stdClass();
          mysqli_stmt_bind_result($stmt, $row->id, $row->username,
                    $row->symptom, $row->number_of_times_tested, $row->original_image,  $row->sequence_of_actions, $row->customized_image, $row->percieved_image
                    );

      }

      mysqli_stmt_free_result($stmt);
      mysqli_close($this->connection);

      return $rows;
  }  
/* create a entry for database patient 
*/
    public function createPatient($item) {
    $stmt = mysqli_prepare($this->connection,
        "INSERT INTO patient (
            id,username,symptom,number_of_times_tested,original_image,sequence_of_actions,  
            customized_image,percieved_image) 
        VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
    $this->throwExceptionOnError();


    mysqli_bind_param($stmt, $item->id , $item->username, $item->symptom,$item->number_of_times_tested,$item->original_image,
        $item->sequence_of_actions, $item->customized_image, $item->percieved_image
    );

    $item->id = '5';
    $item->username = 'abhilash';
    $item->symptom = 'retina pigmentosa'; 
    $item->number_of_times_tested = '3';
    $item->original_image = 'img';
    $item->sequence_of_actions = 'l1l2l2lr3';
    $item->customized_image = 'img';
    $item->percieved_image = 'img';

    $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;
  }

谁能给一个链接到好的详细例子?这样我才能更好地参考和理解

HTTPService在这里用于请求Flex内部的任何类型的HTTP资源。如果需要,您可以设计自己的JSon或基于XML的Web服务,在您的表上执行所需的操作。这种策略与前端无关,例如,如果您选择将前端技术从Flex切换到HTML/Ajax,则不必对后端进行任何更改

另一种解决方案是使用Zend_AMF从Flex通过AMF实现与PHP对象的直接交互


我一直倾向于使用第一种解决方案(没有比我更了解我所做的更有趣的原因),但如果您计划使用仅限flex的前端,第二种解决方案应该会提高您的生产率。

我几乎看不出这一点。PHP是问题所在吗?是否需要帮助来控制服务器端数据库代码?或者你想在弹性方面得到帮助?顺便说一句:为什么你不能使用require_一次?我几乎看不到应该消除的原因,而是脚本文件中的副作用。风格是的,php是个问题,当我包含require_一次(“”)时,zend抛出了一个错误。我想用前端的flex控制数据库操作。