我想在会话变量中存储返回语句的行数,但是我不知道如何。我正在尝试这样做,但是没有用。
$stmt = $con->prepare("SELECT model,type,color FROM item WHERE model LIKE '%$type%'");
$stmt->execute();
$_SESSION['numRows'] = $stmt->num_rows;
echo $_SESSION['numRows'];
$result = $stmt->get_result();
$_SESSION['itemsInfo'] = $result->fetch_all();