tabla productos
<body>
<form action="buscar2.php" method="post">
<input name='nom' id='nom' type="text" value="banana">
<input type="submit" >
<input type="submit" >
</form>
<?php
if (isset($_POST['nom'])) {
$keyw = $_POST['nom'];
$dbhost = 'localhost';
$dbuser = 'minuvahard10';
$dbpass = 'unodostres';
$dbname = 'ventas';
$mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
if($mysqli->connect_errno ) {
printf("Connect failed: %s<br />", $mysqli->connect_error);
exit();
}
$result = $mysqli->query("SELECT * FROM productos where nombre like '$keyw%'");
if ($result->num_rows > 0) {
echo "<table>";
while($row = $result->fetch_assoc()) {
$r2 = $row['imagen'];
echo "<tr>";
echo "<td><img src='productos/$r2' style='width: 300px;'></td><td>".$row['barcode']." ".$row['nombre']." ".$row['precio']."</td>";
echo "</tr>";
}
echo "</table>";
} else {
printf('No record found.<br />');
}
mysqli_free_result($result);
$mysqli->close();
}
?>
</body>
</html>
Se Desarrolla Proyectos Software - Miguel Nunez - minuvasoft10@gmail.com
No hay comentarios:
Publicar un comentario