table.resptable,
.resptable thead,
.resptable tbody,
.resptable th,
.resptable td,
.resptable tr
$conn = new mysqli(.....);
$param = $_GET['manf'];
$stmt = $conn->prepare('select manf from manf where manf = ?');
$stmt->bind_param('s', $param);
$stmt->execute();
$stmt->store_result();
echo $stmt->num_rows;
$result = $stmt->get_result();
if(!$result){
die(mysql_error());
}
while($row = $result->fetch_assoc()){
echo $row['manf'];
}
打印正确的vaule然而我无法从while语句中获得结果。我也试过echo $stmt->num_rows
但是没有用
我怎样才能解决这个问题?
答案 0 :(得分:1)
试试这个:
$conn = new mysqli(.....);
$param = $_GET['manf'];
$stmt = $conn->prepare('select manf from manf where manf = ?');
$stmt->bind_param('s', $param);
$stmt->execute();
$stmt->bind_result($result);
echo $stmt->num_rows;
while($stmt->fetch()){
echo $result;
}
$stmt->close();
要获取,您需要使用$stmt->fetch()
。