![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
03/02/2005, 13:34
|
| | Fecha de Ingreso: febrero-2005
Mensajes: 5
Antigüedad: 20 años Puntos: 0 | |
Comparto la idea de jam..
Debes ir estructurando la query con base a los datos pedidos en el formulario:
Esto es lo que tienes :
<?
$dbh=mysql_connect ("localhost", "root", "") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("precios");
$prod1=$_POST['Amino'];
$prod2=$_POST['carnitina'];
$prod3=$_POST['chromium'];
$var1=$prod1."".$prod2."".$prod3;
?>
<table>
<?
$result=mysql_db_query("precios","select * from productos WHERE id_producto like'%".$var1."%'");
para estructurar la query debe ser algo como esto:
<?
$dbh=mysql_connect ("localhost", "root", "") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("precios");
$var1="select * from productos WHERE id_producto ";
if (!empty($_POST['Amino']))
{
$var1. = "like '%". $_POST['Amino']. "%'";
}
if (!empty($_POST['carnitina']))
{
$var1. = "or like '%". $_POST['carnitina']. "%'";
}
?>
<table>
<?
$result=mysql_db_query("precios",$var1);
Espero que te sea útil |