Please help me to get this to work, sorry if code is not clean, i am just a beginner in PHP
<?php
$strSQL = "SELECT * FROM ps_product";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
while($prices3 = mysql_fetch_array($objQuery)) {
$total_price = $priceCalc;
?>
<?=$prices3["id_product"];?>=><? echo $total_price; ?>,
<? }; ?>
The above code gives me the following result (ID => Price):
3=>55, 4=>28, 5=>35,
How can I add the result into an ARRY?
I want to get this done, in order to look like:
$prices = array(
3=>55,
4=>28,
5=>35,
...
);
foreach ($prices as $id => $price) {
$query = "UPDATE ps_product_shop SET price='".$price."' WHERE
id_product='".$id."' ";
mysql_query($query);
}