Ver Mensaje Individual
  #9 (permalink)  
Antiguo 04/04/2017, 20:20
Avatar de aviweb2015
aviweb2015
 
Fecha de Ingreso: abril-2016
Ubicación: venezuela
Mensajes: 215
Antigüedad: 8 años, 1 mes
Puntos: 1
Respuesta: mostrar imágenes asociadas a un registro

ya lo pude solucionar anexo código completo de como debería quedar doy por cerrado el hilo

Código PHP:
Ver original
  1. <?php
  2.  
  3.  
  4.  
  5.  
  6. $sql = "
  7. SELECT
  8. detalles_categorias.id,
  9. detalles_categorias.fk_categorias,
  10. detalles_categorias.precio,
  11. detalles_categorias.descripcion,
  12. detalles_categorias.detalles,
  13. GROUP_CONCAT(detalles_img.imagen SEPARATOR '-') AS imagen
  14. FROM detalles_categorias INNER JOIN detalles_img ON detalles_img.fk_detalles_categorias = detalles_categorias.id
  15. WHERE detalles_img.fk_detalles_categorias = detalles_categorias.id
  16. GROUP BY detalles_img.fk_detalles_categorias";
  17. $consulta = $DB_con->prepare($sql);
  18. $consulta->execute();
  19. if($consulta->rowCount() > 0){
  20. $i=1;
  21.  
  22. echo "<table  class='bordered responsive-table'>
  23. <thead>
  24. <tr>
  25. <th data-field='Nº'>Nº</th>
  26. <th data-field='Código'>categorias</th>
  27. <th data-field='Código'>precio</th>
  28. <th data-field='Código'>descripcion</th>
  29. <th data-field='Código'>detalles</th>
  30. <th data-field='Código' colspan='2'>imagenes</th>
  31. <th data-field='Operaciones'>Operaciones Administrador</th>
  32. </tr>
  33. </thead>";
  34. while ($linea = $consulta->fetch(PDO::FETCH_ASSOC)) {
  35.  
  36. echo "
  37. <tr>
  38. <td align=center>$i</td>
  39. <td align=center>{$linea['fk_categorias']}</td>
  40. <td align=center>{$linea['precio']}</td>
  41. <td align=center>{$linea['descripcion']}</td>
  42. <td align=center>{$linea['detalles']}</td>
  43. ";
  44. ?>
  45.  
  46.  
  47. <?php
  48. $detalles_img = explode("-", $linea['imagen']);
  49. foreach ($detalles_img as $value) {
  50. echo ('<td colspan="2"><img src="http://www.forosdelweb.com/f86/galerias/'.$value.'" class=responsive-img circle center-align width=50px height=50px/></td>') ;
  51. }
  52. ?>
  53.  
  54. <?php
  55. echo "<td colspan='2'>
  56. <form action='actualizar_multiple.php' method='GET'>
  57. <input type=hidden name=id value='$linea[id]'>
  58. <button class='btn waves-effect blue-grey darken-4 left  
  59. btn-small tooltipped' data-position='bottom'
  60. data-tooltip='Actualizar' type='submit' name='actualizar'>
  61. <i class='material-icons'>update</i>
  62. </button></form>
  63.  
  64. <form action='consultar_seguros.php' method='POST'>
  65. <input type=hidden name=id value='$linea[id]'>
  66. <button class='btn waves-effect blue-grey darken-4 left  
  67. btn-small tooltipped' data-position='bottom'
  68. data-tooltip='Eliminar' type='submit' name='eliminar'>
  69. <i class='material-icons'>delete</i>
  70. </button></form>
  71.  
  72. <a href='multiple.php'
  73. <button class='btn waves-effect blue-grey darken-4 left  
  74. btn-small tooltipped' data-position='bottom'
  75. data-tooltip='Volver' type='submit'>
  76. <i class='material-icons'>reply_all</i>
  77. </button></a>
  78.  
  79.  
  80.  
  81.  
  82. </td>
  83. </tr>";
  84. $i++;
  85. }
  86. }else
  87. echo "<div class='col s12 card-panel yellow darken-2 center'>
  88. <h5 class='black-text text-darken-2 center CONDENSED LIGHT5'>
  89. ¡ Advertencia: No se ha encontrado ningún registro ! <a href='multiple.php' class='teal-text darken-4'>volver</a>
  90. </h5>
  91. </div>";
  92.  
  93. echo "</table>";
  94.  
  95.  
  96. ?>
__________________
yoclens avilan