Update Page If Query Return False

Asked

Viewed 20 times

0

Guys, next I have this appointment here

$consultapedidos = mysql_query("SELECT * FROM pedidos WHERE produzido = '0'");
if(mysql_num_rows($consultapedidos)==true){
while($lnped = mysql_fetch_array($consultapedidos))
}

when it returns true I want it to list the results it found, but if it returns false, I want it to update the page every 5 seconds until it finds a record. Does anyone have any idea how I can do that?

1 answer

0


$consultapedidos = mysql_query("SELECT * FROM pedidos WHERE produzido = '0'");
if(mysql_num_rows($consultapedidos)==true){
    while($lnped = mysql_fetch_array($consultapedidos)) {
    }
} else {
    echo '<meta http-equiv="refresh" content="5"/> ';
}

Basically this, print the tag to update every 5 seconds, just implement in your code in the best way.

I hope it helps

Hug

  • Thank you very much, hadn’t thought of this logica yet kkk, it worked correctly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.