Select * for mysql prepare statement not listing a

2019-08-08 04:56发布

问题:

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);

}
标签: mysql prepare