Ver Mensaje Individual
  #4 (permalink)  
Antiguo 29/10/2017, 10:32
elsaiya
 
Fecha de Ingreso: marzo-2012
Ubicación: El Vigia Edo Merida
Mensajes: 147
Antigüedad: 12 años, 1 mes
Puntos: 1
Respuesta: wqdwqdwqdw

me da ahora el siguiente error, Notice: Undefined variable: p in C:\xampp\htdocs\restaurant\class\class.php on line 4914 la cual es esta $existenciadb = $p[0]["existencia"];


Código PHP:
Ver original
  1. $venta = $_SESSION["CarritoVentas"];
  2.         for($i=0;$i<count($venta);$i++){
  3.        
  4.         $sql2 = "select existencia from productos where '".$venta[$i]['txtCodigo']."'";
  5.         $stmt = $this->dbh->prepare($sql2);
  6.         $num = $stmt->rowCount();
  7.        
  8.             if($row = $stmt->fetch(PDO::FETCH_ASSOC))
  9.             {
  10.                 $p[] = $row;
  11.             }
  12.         $existenciadb = $p[0]["existencia"];   
  13.        
  14.         if($venta[$i]['cantidad'] > $existenciadb) {
  15.        
  16.                        echo "4";
  17.                        exit;
  18.                                                    }
  19.                                       }