我想在另一个查询中使用绑定结果中的变量但是我得到一个错误,说结果是非对象。
PHP Fatal error: Call to a member function bind_param() on a non-object in
$stmt =mysqli_prepare($link, "SELECT DISTINCT COL1 from TABLE1 WHERE COLID = ?");
$stmt->bind_param("s", $SOMEID);
$stmt->execute();
$stmt->bind_result($COL1);
while ($stmt->fetch()) {
$stmt1 =mysqli_prepare($link, "SELECT COLA from TABLE2 WHERE COLID = ?");
$stmt1->bind_param("s", $COL1);
$stmt1->execute();
$stmt1->bind_result($COLA);
$stmt1->fetch();
if (!$COLA)
{
echo $COLA;
}
}
如何使用$COL1
选择$COLA
?