我想在我的index.php中返回u,p,d的值,但我不知道该返回什么代码
$stmt = $this->mysqli->prepare("SELECT u,p,d FROM pump_price");
$stmt->execute();
$stmt->bind_result($u,$p,$d);
while ($row = $stmt->fetch()) {
// what to return here?
}
$stmt->close();
$this->mysqli->close();
bind_result()
函数应为结果集中的每个记录提供变量u
,p
和d
中$u
,$p
和$d
的值。因此,您可以尝试以下操作:
$stmt = $this->mysqli->prepare("SELECT u, p, d FROM pump_price");
$stmt->execute();
$stmt->bind_result($u,$p,$d);
while ($row = $stmt->fetch()) {
echo "(" . $u . ", " . $p . ", " . $d . ")" . "\n";
}
$stmt->close();
$this->mysqli->close();