Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
564
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.87 KB | None | 0 0
  1. <?php
  2.  
  3.    require_once('conexion.php');
  4.  
  5.    $xAsunto = 'veintitres cuarenta y cinco';
  6.    $xAdjunto = '-';
  7.    $xIdTbroperacion = 0;
  8.    $xFecha = '2010-11-10';
  9.    $xIdCatCuentas = 5;
  10.    $xIdUsuario = 1;
  11.    $xResultado = 'Ok';
  12.    $xIdCatListas = 5;
  13.    $xIdCatTemplates = 1;
  14.    $xDestinatarios[] = array('email'=>'mail1@hotmail.com','nombre'=>'Name 1');
  15.    $xDestinatarios[] = array('email'=>'mail2@yahoo.com.mx','nombre'=>'Name 2');
  16.    $xDestinatarios[] = array('email'=>'mail3@live.com.mx','nombre'=>'Name 3');
  17.  
  18.    echo $xIdTbroperacion;
  19.    //Realizamos directamente la operación, recorriendo cada elemento del arreglo de cuentas.
  20.    foreach($xDestinatarios as $elemento){
  21.        if($xIdTbroperacion==0){
  22.            $consultaSP = "call pa_insoperacion('".$xFecha."',".$xIdCatCuentas.", ".$xIdCatListas.", ".$xIdCatTemplates.",".$xIdCatTemplates.",'".$elemento['email']."','".$xResultado."', '".$xAsunto."')";
  23.        } else {
  24.            //$consultaSP = "call pa_insresultado(".$xIdTbroperacion.", '".$elemento['email']."','".$xResultado."')";
  25.            /*$consultaSP = "INSERT INTO tbrresultado (tbroperacion_idTbroperacion, email, resultado)
  26.                           VALUES (".$xIdTbroperacion.", '".$elemento['email']."', '".$xResultado."')";*/
  27.            $consultaSP = "SELECT * FROM tbrresultado WHERE tbroperacion_idTbroperacion = $xIdTbroperacion";
  28.            echo $consultaSP;
  29.        }
  30.  
  31.        $res = mysql_query($consultaSP);
  32.        if (mysql_num_rows($res)){
  33.            while ($row = mysql_fetch_array($res)){
  34.                echo $row['idOperacion'];
  35.                if($xIdTbroperacion==0){
  36.                    $xIdTbroperacion = $row['idOperacion'];
  37.                }
  38.                $datos[] = array('respuesta'=>$consultaSP);
  39.        }
  40.     } else {
  41.             echo 'No hay filas';
  42.         }
  43.        
  44.    }
  45.  
  46.    echo '<pre>';
  47.    print_r($datos);
  48.    echo '</pre>';
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement