function editarProducto($idPro) { $mysql = conexionMySql(); $sql = "SELECT * FROM productos WHERE idpro={$idPro} ORDER BY idpro DESC"; if ($resultado = $mysql->query($sql)) { //mustro el form con los datos del registro $fila = $resultado->fetch_assoc(); $form .= "<div id='muestrat'>"; $form .= " <ul >"; $form .= "<li class='muestrat1'>"; $form .= "<label for ='name'>" . $fila["nombre"] . ":</label>"; $form .= "</li>"; $form .= "<li class='muestrat2'>"; $form .= "<label for ='descripcion'>" . $fila["descripcion"] . ":</label>"; $form .= "</li>"; $form .= "</ul>"; $form .= "</div>"; $form .= " <ul class='slider5'>"; $form .= "<li>"; $form .= "<input type='radio' id='sbutton1' name='sradio' checked>"; $form .= "<label for='sbutton1'></label>"; $form .= "<td><img src='php/" . $fila["imagen"] . "'/></td>"; $form .= "</li>"; $form .= "<li>"; $form .= "<input type='radio' id='sbutton2' name='sradio' checked>"; $form .= "<label for='sbutton2'></label>"; $form .= "<td><img src='php/" . $fila["imagen2"] . "'/></td>"; $form .= "</li>"; $form .= "<li>"; $form .= "<input type='radio' id='sbutton3' name='sradio' checked>"; $form .= "<label for='sbutton3'></label>"; $form .= " <iframe width='1280' height='720' src='https://www.youtube-nocookie.com/embed/PPu_IlP1D70' frameborder='0' aallowfullscreen></iframe>"; $form .= "</li>"; $form .= "<li>"; $form .= "<input type='radio' id='sbutton4' name='sradio' checked>"; $form .= "<label for='sbutton4'></label>"; $form .= "<td><img src='php/" . $fila["imagen3"] . "'/></td>"; $form .= "</li>"; $form .= "</ul>"; $form .= "</fieldset>"; $form .= "</form>"; $resultado->free(); } else { //muestro el mensaje del error $form = "<div class='error'>Error: No se ejecuto la consulta de la base de datos</div>"; } $mysql->close(); return printf($form); }
function mostrarHeroes() { $editorial = catalogoEditoriales(); $mysql = conexionMySql(); $sql = "Select * from heroes order by IdHeroe desc"; if ($resultado = $mysql->query($sql)) { if (mysqli_num_rows($resultado) == 0) { $respuesta = "<div class='error'><strong>Error: NO existen registros de Super" . "Héroes, la Base de Datos esta vacía.</strong></div>"; } else { $tabla = "<table id='tablaHeroes' class='tabla'>"; $tabla .= "<thead>"; $tabla .= "<tr>"; $tabla .= "<th>Id Héroe</th>"; $tabla .= "<th>Nombre</th>"; $tabla .= "<th>Imagen</th>"; $tabla .= "<th>Descripción</th>"; $tabla .= "<th>Editorial</th>"; $tabla .= "<th></th>"; $tabla .= "<th></th>"; $tabla .= "</tr>"; $tabla .= "</thead>"; $tabla .= "<tbody>"; while ($fila = $resultado->fetch_assoc()) { $tabla .= "<tr>"; $tabla .= "<td>" . $fila["IdHeroe"] . "</td>"; $tabla .= "<td><h2>" . $fila["Nombre"] . "<h2></td>"; $tabla .= "<td><img src='Img/" . $fila["Imagen"] . "'alt='Kickass'/></td>"; $tabla .= "<td><p>" . $fila["Descripcion"] . "</p></td>"; $tabla .= "<td><h3>" . $editorial[$fila["Editorial"]] . "</h3></td>"; $tabla .= "<td>Botón Editar.</td>"; $tabla .= "<td>Botón Eliminar.</td>"; $tabla .= "</tr>"; } $resultado->free(); $tabla .= "</tbody>"; $tabla .= "</table>"; $respuesta = $tabla; } } else { $respuesta = "<div class='error'><strong>Error: No se ejecuto la consulta a la " . " Base de Datos</strong></div>"; } return printf($respuesta); }