Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/08/2013, 09:32
Avatar de shake2427
shake2427
 
Fecha de Ingreso: julio-2011
Mensajes: 116
Antigüedad: 12 años, 10 meses
Puntos: 3
no me funciona $DB->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY ,t rue);

buenas


segun he buscado este codigo

Código PHP:
Ver original
  1. $DB->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY,true);

me sirve para evitar este error

Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.' in C:\AppServ\www\movist@rmoviles\src\class\class.neg ocio.php:36

pero no me quiere funcionar me sigue apareciendo el mismo error

el codigo completo es el siguiente.

Código PHP:
Ver original
  1. public function add_negocio($addnombrenegocio,$addsociedadnegocio,$addperscontacnegocio,
  2.                                 $addzonanegocio,$addubicnegocio,$adddirecnegocio,$addbarrionegocio,
  3.                                 $addtelfijonegocio,$addcelularnegocio,$addmuniciunegocio,
  4.                                 $addemailnegocio,$addcedulanitnegocio,$addpasswnegocio){
  5.        
  6.            
  7.                 //conexion BD
  8.             $classDB = new conexion;
  9.             $DB = $classDB->conexionBD();  
  10.            
  11.             $DB->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  12.             $DB->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY,true);
  13.            
  14.             $DB->beginTransaction();
  15.             $qryvalicedula = $DB->prepare('CALL consulta_validacion_cedula(:cedula)');
  16.             $qryvalicedula->bindParam(':cedula', trim($addcedulanitnegocio));
  17.             $qryvalicedula->execute();
  18.             $DB->commit();
  19.             $qryvalicedula->closeCursor();
  20.            
  21.            
  22.             if($restotal = $qryvalicedula->rowcount() >= 1){
  23.                 $responseaddnegocio = "yaexiste";
  24.             }
  25.             else{
  26.                
  27.                 list($ciudad,$departamento) = explode("-",$addmuniciunegocio);
  28.                
  29.                 $qryvalimunicipio = $DB->prepare('CALL consulta_verificacion_municipio(:ciudad,:departamento)');
  30.              
  31.                 $DB->beginTransaction();
  32.                 $qryvalimunicipio->bindParam(':ciudad', trim($ciudad));
  33.                 $qryvalimunicipio->bindParam(':departamento', trim($departamento));
  34.                 $qryvalimunicipio->execute();
  35.                 $DB->commit();
  36.                 $qryvalimunicipio->closeCursor();
  37.                
  38.                
  39.                 if($restotalmuni = $qryvalimunicipio->rowcount() <= 0){
  40.                     $responseaddnegocio = "muninoexiste";
  41.                 }
  42.                 else{
  43.                     $responseaddnegocio = false;   
  44.                 }
  45.                
  46.             }
  47.  
  48.         return $responseaddnegocio;
  49.     }