Advertisement
gonzalob

Untitled

Dec 6th, 2014
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.87 KB | None | 0 0
  1. <?php
  2. $enlace = mysql_connect('localhost', 'mineco_prod', 'Appneco2014');
  3. if (!$enlace)
  4. {
  5.     die('No se pudo conectar : ' . mysql_error());
  6. }
  7.  
  8. $bd_seleccionada = mysql_select_db('mineco_produccion', $enlace);
  9. if (!$bd_seleccionada)
  10. {
  11.     die ('No se puede usar mineco_produccion : ' . mysql_error());
  12. }
  13. mysql_query ("SET NAMES 'utf8'");    
  14.  
  15. $sql="SELECT * from banners order by orden DESC";
  16. $result = mysql_query($sql) or die('query did not go through');
  17. while ($rowEmp = mysql_fetch_assoc($result))
  18. {
  19.     $banner = null;
  20.     $banner['url_link']     = $rowEmp['url_link'];
  21.     $banner['imagen']       = "http://minecochea.com.ar/imagenes/auspicios/".$rowEmp['imagen'];
  22.     $banner['id_comercio']  = $rowEmp['id_comercio'];
  23.     $banner['id_categoria'] = $rowEmp['id_categoria'];
  24.     $banner['link'] = $rowEmp['link'];
  25.    
  26.        
  27.     $data[] = $banner;
  28. }
  29. echo json_encode($data,true);
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement