I am new at php/mysql. I am having trouble with looping. What Im
trying to do is have multiple part numbers under 1 variable. If i just
put $pnum = thepartnumber and echo $fprice, it will take the 1st value
and carry it down till the end. Below is my current code.
:code begin:
<?
$connection = mysql_connect("localhost","user","pass")
or die("Unable to connect to localhost");
$db = mysql_select_db(database)
or die("Unable to connect to database");
while($pnum = 3)
{
$i = 1;
$pnum = '749125';
$pnum = $pnum +$i;
$result = mysql_query("SELECT * FROM products WHERE part_num =
'$pnum'");
$price = mysql_result($result,0,"cost");
$fprice = ceil($price * 1.2);
$pnum = '749125';
echo "<br>";
echo $fprice;
$pnum = '749126';
echo "<br>";
echo $fprice;
}
?>
:code end:
what am i doing wrong. btw I did get it to work so it would grab just
1 part numbers price without the loop, but I need it to get multiple
part numbers. Any help is appricated.