问题
I'm trying to convert a part of code into prepare statements and can't make work the select statement.
It doesn't throw an error, it just don't list the items. Instead of displaying the results it says there are no entries (double check and there are in db).
Any help is much appreciated.
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);
}
来源:https://stackoverflow.com/questions/18399332/select-for-mysql-prepare-statement-not-listing-anything