a4udi
05-07-2006, 05:34 AM
Hi,
I'm trying to make a page that will update prices but I'm having trouble with 2 things. One is I have written some code that will insert the information into the database (which works), but I want to update it 'overwrite' each time instead of add a new row.
mysql_select_db('****');
$query = "insert into rates values
('".$rate01."', '".$rate02."', '".$rate03."', '".$rate04."', '".$rate05."', '".$rate06."')";
$result = mysql_query($query);
if ($result)
echo "<b>Prices have been Updated.</b>";
The second issue is after the user inputs these values, how to retreive them and print them out on a new page... So far I have this.
mysql_select_db('***');
$query01 = "select rate01 from rates";
$result01 = mysql_query($query01);
// Output the HTML with SQL values
echo "<span class='body'>Price: $result01</span></p>";
The Problem is, instead of printing "Price: $4.00" or whatever $result01 is, it's printing "Price: Resource id #3" instead. Anyone know why this is? :confused:
Any help is greatly appreciated!
I'm trying to make a page that will update prices but I'm having trouble with 2 things. One is I have written some code that will insert the information into the database (which works), but I want to update it 'overwrite' each time instead of add a new row.
mysql_select_db('****');
$query = "insert into rates values
('".$rate01."', '".$rate02."', '".$rate03."', '".$rate04."', '".$rate05."', '".$rate06."')";
$result = mysql_query($query);
if ($result)
echo "<b>Prices have been Updated.</b>";
The second issue is after the user inputs these values, how to retreive them and print them out on a new page... So far I have this.
mysql_select_db('***');
$query01 = "select rate01 from rates";
$result01 = mysql_query($query01);
// Output the HTML with SQL values
echo "<span class='body'>Price: $result01</span></p>";
The Problem is, instead of printing "Price: $4.00" or whatever $result01 is, it's printing "Price: Resource id #3" instead. Anyone know why this is? :confused:
Any help is greatly appreciated!