0

i want select then insert in php code but my code do nothing.

public function deliverOrders($id_d){
    $p=$this->db->prepare("select saldo from admins where name='".$_SESSION['name']."'");
    $orders=$p->fetchAll(PDO::FETCH_OBJ);
    return $orders;
    if ($orders < 1000){
        echo"<script>alert('you deposit less than 1000);</script>";
    }

    else{
    $q=$this->db->prepare("update orders_foods set status=1 where id=?");

    if($q->execute([$id_d])){

echo"<script>window.location.href='index.php?page=orders';
                        alert('berhasil di kirim');</script>";

    }
    else{
        echo"<script>window.location.href='index.php?page=orders';
                        alert('gagal dikirim');</script>";
    }
}

Edited by happygeek: moved

2
Contributors
1
Reply
11
Views
1 Week
Discussion Span
Last Post by pty
1

Why are you using PHP for this? Can't you just use anupdate statement with a where clause?

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.