hello
i have a form with 5 fields. and my problem is that if user put 2 or more
same variables my script finds in db only 1 and i need to search all
variables in db even if they r same.
<http>
<body>
<?php
$A=$_POST['A'];
$u=$_POST['u'];
$B=$_POST['B'];
$w=$_POST['w'];
$C=$_POST['C'];
$x=$_POST['x'];
$D=$_POST['D'];
$y=$_POST['y'];
$E=$_POST['E'];
$z=$_POST['z'];
require("connec t.php");
$query ="SELECT matom,nazwa FROM chem WHERE symb LIKE '$A' OR symb LIKE '$B'
OR symb LIKE
'$C' OR symb LIKE '$D' OR symb LIKE '$E'";
$result = mysql_query ($query) or die ("Zapytanie zakonczone
niepowodzeniem" );
$wiersze=mysql_ num_rows($resul t);
echo"<br>$wiers ze";
for ($i=0;$i<$wiers ze;$i++) {
$wiersz = mysql_fetch_arr ay($result);
$a=$wiersz["matom"];
$b=$wiersz["nazwa"];
$tab_b[]=$b;
$tab_a[]=$a;
echo "Masa molowa <b>$b"."u</b> wynosi $a<br>";
}
if(!$u)
$u=1;
if(!$w)
$w=1;
if(!$x)
$x=1;
if(!$y)
$y=1;
if(!$z)
$z=1;
$M=($tab_a[0]*$u)+($tab_a[1]*$w)+($tab_a[2]*$x)+($tab_a[3]*$y)+($tab_a[4]*$z
);
echo "<br>".$M;
mysql_free_resu lt($result);
mysql_close($li nk);
?>
regards
i have a form with 5 fields. and my problem is that if user put 2 or more
same variables my script finds in db only 1 and i need to search all
variables in db even if they r same.
<http>
<body>
<?php
$A=$_POST['A'];
$u=$_POST['u'];
$B=$_POST['B'];
$w=$_POST['w'];
$C=$_POST['C'];
$x=$_POST['x'];
$D=$_POST['D'];
$y=$_POST['y'];
$E=$_POST['E'];
$z=$_POST['z'];
require("connec t.php");
$query ="SELECT matom,nazwa FROM chem WHERE symb LIKE '$A' OR symb LIKE '$B'
OR symb LIKE
'$C' OR symb LIKE '$D' OR symb LIKE '$E'";
$result = mysql_query ($query) or die ("Zapytanie zakonczone
niepowodzeniem" );
$wiersze=mysql_ num_rows($resul t);
echo"<br>$wiers ze";
for ($i=0;$i<$wiers ze;$i++) {
$wiersz = mysql_fetch_arr ay($result);
$a=$wiersz["matom"];
$b=$wiersz["nazwa"];
$tab_b[]=$b;
$tab_a[]=$a;
echo "Masa molowa <b>$b"."u</b> wynosi $a<br>";
}
if(!$u)
$u=1;
if(!$w)
$w=1;
if(!$x)
$x=1;
if(!$y)
$y=1;
if(!$z)
$z=1;
$M=($tab_a[0]*$u)+($tab_a[1]*$w)+($tab_a[2]*$x)+($tab_a[3]*$y)+($tab_a[4]*$z
);
echo "<br>".$M;
mysql_free_resu lt($result);
mysql_close($li nk);
?>
regards
Comment