Urgent Help! (Simple qns): Assigning value from mysql table.

Say I have a user input $quantity, for a quantity of items.

I have a table in a mysql database with all the price.

To calculate total price,

$total_price = $quantity * $price

How do I assign a value to $price from a table? I tried $price = “SELECT price_list.handbag from price_list” but it prints it out as a string. any help here? Thanks!

run a query

[php]

SQL = “SELECT price_list.handbag from price_list”;
$result = mysql_query($SQL) or die(mysql_error());

$row= mysql_fetch_assoc($result) or die(mysql_error());

//assign the value of hangbag from Database to the variable price
$price = $row[‘hangbag’];
[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service