Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $sql= mysql_query("SELECT * FROM repuesto");
- while($res= mysql_fetch_array($sql)){
- echo '<form action="descripcion.php" method="POST">';
- echo '<div class="col">';
- echo '<figure class="img-border"><a href="descripcion.php"><img src="../Administrador/pages/RepuestoCRUD/'.$res["imagen_repuesto"].'"width="230" heigth="220"></a></figure>';
- echo'<h6>'.$res["nombre_repuesto"].'</h6>';
- echo'<h6>$'.$res["precio_repuesto"].'</h6>';
- echo'<p class="p2">'.$res["descripcion_repuesto"].'</p>';
- echo '<input type="submit" value="Aceptar">';
- echo'<a class="button" href="descripcion.php">Leer Mas</a>';
- echo '</div>';
- echo '</form>';
- }
- ?>
- /******** CONECTAR CON BASE DE DATOS **************** */
- $con = mysql_connect("localhost","root","");
- if (!$con){die('ERROR DE CONEXION CON MYSQL: ' . mysql_error());}
- /* ********************************************** */
- /********* CONECTA CON LA BASE DE DATOS **************** */
- $database = mysql_select_db("sicoa",$con);
- if (!$database){die('ERROR CONEXION CON BD: '.mysql_error());}
- /* ********************************************** */
- //ejecutamos la consulta
- $sql = "SELECT nombre_repuesto, descripcion_repuesto, precio_repuesto FROM repuesto WHERE idrepuesto='"
- .$_POST['idrepuesto']."'";
- $result = mysql_query ($sql);
- // verificamos que no haya error
- if (! $result){
- echo "La consulta SQL contiene errores.".mysql_error();
- exit();
- }else {
- echo "<table border='1'><tr><td>Nombre</td><td>Precio</td><td>Existencia</td>
- </tr><tr>";
- //obtenemos los datos resultado de la consulta
- while ($row = mysql_fetch_row($result)){
- echo "<td>".$row[0]."</td><td>".$row[1]."</td>
- <td>".$row[2]."</td>";
- }
- echo "</tr></table>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement