我正在尝试将部分代码转换为准备语句,并且无法使 select 语句起作用。
它不会抛出错误,只是不列出项目。它没有显示结果,而是说没有条目(仔细检查并且在 db 中有)。
任何帮助深表感谢。
if($_GET[action]=='view-rss')
{
$count =0;
$stmt = $GLOBALS["___mysqli_ston"]->prepare("select * from rss where lang=(?)");
$stmt->bind_param('s', $_SESSION[session_lang]);
$stmt->execute();
$stmt->close();
while($stmt=mysqli_fetch_assoc($query))
{
$rss_ids[] = $row['id'];
$rss_urls[] = $row['url'];
$rss_titles[] = $row['title'];
$rss_publishes[] = $row['published'];
$count= $count +1;
}
$smarty->assign("rss_ids", $rss_ids);
$smarty->assign("rss_urls", $rss_urls);
$smarty->assign("rss_titles", $rss_titles);
$smarty->assign("rss_publishes", $rss_publishes);
$smarty->assign("count", $count);
}