Update PHP UPDATE

Asked

Viewed 176 times

0

Good evening I am trying to update a register of delivery of lunch boxes, I click on the button to update and update right in the bank, but when I will update again the same order for delivered, the information is not updated, only after a time of the first UPDATE that the data is updated in the database... example if I updated status for in transit now, only after a few minutes to update the status to delivered. Someone can help me?

if($pedido > 0 && $status > 0){

 $atualizar = mysql_query("UPDATE pedidos SET id_status = '$status' WHERE 
 id_pedido= '$pedido'");

        if($atualizar){
            echo "atualizado, pedido $pedido e status $status";
        }else{
            echo "erro ".mysql_error();
        }
}

HTML:

<tr>
 <td>
  <?php echo $linha["id_pedido"]; ?>
 </td>
 <td>
  <select name="status">    
   <option value='2'> Em Trânsito </option>
   <option value='4'> Entregue </option>
 </select>
 </td>
 </tr>
  • After updating for the second time, check in the bank. There is a lot of information to analyze there. Where the variable definition comes from $pedido? There is a check and a query simple. Is right if the check is true.

  • That’s weird, if the page loads normal, and you can only change it in a few minutes, it would be loop problem maybe. More you would notice. You have to see if when setting the status, as this information is requested from the server.

No answers

Browser other questions tagged

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