Scott. Thanks A Lot for your help. I got output - Finally.
I also figured out how to get a percentage added to the cost, and how to round the decimal numbers.
Here is the final code:
<?
//Variables
$dbhost = "localhost";
$dbuser = "ODBC";
$dbpass = "";
$dbname = "products";
$id = "340922";
//Connect
$db = mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db("$dbname",$db);
//Query
$query = mysql_query("SELECT descr, cost FROM products WHERE part_num ='$id'");
list($descr, $cost) = mysql_fetch_row($query);
$part_num = $row[0];
//Add Percentage & Round
function add_percent ($price, $percent) {
$newprice = $price * (1 + ($percent/100));
return number_format($newprice,2);
}
//Display Data
print ("\n <U>Product Number:</U> $id <P>");
print ("\n <U>Description:</U> $descr <P>");
print ("\n <U>Our Price: </U> $".add_percent($cost, 15));
print ("<P>");
?>
I also figured out how to get a percentage added to the cost, and how to round the decimal numbers.
Here is the final code:
<?
//Variables
$dbhost = "localhost";
$dbuser = "ODBC";
$dbpass = "";
$dbname = "products";
$id = "340922";
//Connect
$db = mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db("$dbname",$db);
//Query
$query = mysql_query("SELECT descr, cost FROM products WHERE part_num ='$id'");
list($descr, $cost) = mysql_fetch_row($query);
$part_num = $row[0];
//Add Percentage & Round
function add_percent ($price, $percent) {
$newprice = $price * (1 + ($percent/100));
return number_format($newprice,2);
}
//Display Data
print ("\n <U>Product Number:</U> $id <P>");
print ("\n <U>Description:</U> $descr <P>");
print ("\n <U>Our Price: </U> $".add_percent($cost, 15));
print ("<P>");
?>