mercredi 23 décembre 2020

if then nested statements cause page not to load

NEW CODE - and a new question since some unhelp person decided to close the original. AS per the suggestions of others I have added to the initial code. Same result:

I am having an issue with the following IF statement.

When it finds results on either of the two conditions it works great and returns the results using the for each statement. If there are no results then the page doesn't load completely. I have tried using die; in a number of locations which did not improve the functions or make this work.

NEW CODE

    if (!empty($query)){
 foreach($query as $available){
echo $available->column1. "<br>\n";}}

elseif (empty($query)) {
    $query_plus->get_results($wpdb->prepare("SELECT column1 FROM mytable"));
    foreach($query as $available_plus_2){
    echo $available_plus_2->column1. "<br>\n";}}

elseif (!empty($query_plus)){echo "nothing here";}

Aucun commentaire:

Enregistrer un commentaire