Guest User

Untitled

a guest
Dec 28th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. <?
  2. $restIds=$_SESSION['restaurants'];
  3. $restIds=substr($restIds,0,strlen($restIds)-1);
  4.  
  5. $query="SELECT cli.restaurant_id as id, CONCAT(cli.nombre,' ',cli.sucursal) as nombre FROM s3menudt.clientes cli left join options opt on (opt.restId=cli.restaurant_id) WHERE cli.restaurant_id in ($restIds) and opt.controlCatalogos=1";
  6.  
  7. $result = $mysqli->query($query);
  8.  
  9. if (mysqli_num_rows($result)!=0)
  10. {
  11. ?><label>Sucursal:</label>
  12. <select name="idSucursal" id="idSucursal"><?
  13. while($row = $result->fetch_array(MYSQLI_ASSOC))
  14. {
  15. if($fst==0 and $_SESSION['idSucursal']==''){
  16. $_SESSION['idSucursal']=$row['id'];
  17. }
  18. echo '<option id="'.$row['id'].'" value="'.$row['id'].'"';
  19. if($row['id']==$_SESSION['idSucursal']) echo ' selected';
  20. echo '>'.$row['nombre'].'</option>';
  21.  
  22. $fst++;
  23. }
  24. ?></select><br><?
  25. }
  26. else{ echo "<script>alert('No hay sucursales configuradas para ediciΓ³n Web.'); window.top.location='../landing/index.php'; </script>"; die(); }
  27. ?>
  28. </div>
  29. <?
  30. $col = $col + 2;
  31. $jsvars .= 'var idSucursal = $("#idSucursal").val();
  32. ';
  33. $params .= 'idSucursal';
  34. $fsucursalCat = false;
  35. }
  36.  
  37. elseif($fcatalogos){ ?>
  38. <!-- ++++++++++++ CATÁLOGO ++++++++++++ -->
  39. <div class="col-md-2">
  40. <?
  41.  
  42. //Creo que tu conexiΓ³n es $mysqli ????
  43. $stmt = $dbConnection->prepare('SELECT cli.restaurant_id as id, CONCAT(cli.nombre,' ',cli.sucursal) as nombre FROM s3menudt.clientes cli left join options opt on (opt.restId=cli.restaurant_id) WHERE cli.restaurant_id in ($restIds) and opt.controlCatalogos=1');
  44.  
  45. $stmt->bind_param('s', $nombre); // 's' especifica el tipo de dato => 'string'
  46.  
  47. $stmt->execute();
  48.  
  49. $result = $stmt->get_result();
  50. while ($row = $result->fetch_assoc()) {
  51. // Hacer cosas seguras :)
  52. }
Add Comment
Please, Sign In to add comment