gpt4 book ai didi

php - Flash Builder/php/mysql 函数

转载 作者:行者123 更新时间:2023-11-29 17:49:05 24 4
gpt4 key购买 nike

我正在尝试在 Flash Builder 中使用 php 函数...但是,该函数的返回值是意外的...一个空白的 [] (对象)而不是数组。其功能是:

public function getAllAuctions($search) {

$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename WHERE name LIKE ?");
$this->throwExceptionOnError();

mysqli_stmt_bind_param($stmt, 'i', $search);
$this->throwExceptionOnError();


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

$rows = array();

mysqli_stmt_bind_result($stmt, $row->id, $row->name);

while (mysqli_stmt_fetch($stmt)) {
$rows[] = $row;
$row = new stdClass();
mysqli_stmt_bind_result($stmt, $row->id, $row->name);
}

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

return $rows;
}

The data service - others work just fine

Testing function

综上所述...我期待收到一个数组,一个 mysql 搜索查询的结果;而是接收一个空白对象:[]有什么想法吗?

最佳答案

问题出在绑定(bind)参数部分:mysqli_stmt_bind_param($stmt, 'i', $search); ....它应该是:mysqli_stmt_bind_param($stmt, 's', $search);

关于php - Flash Builder/php/mysql 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49551532/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com