I'm trying to run a while loop from a MySQL query (which I've done a ton of times) and I can't get it to run for some reason. If I run the code below, I get 'test' echoed out but not 'test2' even though there are entries in the database that match the criteria in my SQL query. I guess I'm just trying to see if I'm overlooking something in the syntax?
I have the database connect files included on the page with 'require' statements so the page wouldn't even run if it was a mistake when connecting to the database.
Any ideas? I'm sorry if this is basic, it's just been driving me crazy this morning. Thank you for your help!
$sql_all = "SELECT * FROM wp_posts WHERE post_type = 'post' AND post_status != 'trash' AND post_status != 'auto-draft'";
$result_all = $mysqli->query($sql_all);
echo "test";
while($row_all == mysqli_fetch_array($result_all)){
echo "test2";
}