Forum Moderators: coopster
Added product one....
Added product two....
Added product three...
As opposed to:
Your products have been updated and we have added
product one....
product two....
product three...
Is javascript required?
Good luck!
Not sure if I understand you correctly regarding echoing multiple queries out one at a time as I have never been able to achieve this when the queries are within a single page?
Any pointers would be much appreciated.
Does anyone know a way of echoing results as they are inputted?
Query within a for loop:
for($i=1; $i<count($contents); ) {
$query = "UPDATE products SET price = $price WHERE model = '$checkmodel'";
mysql_query($query) or die(mysql_error());
echo 'Updated Price of Model: <strong>'. $checkmodel.'</strong> To £<strong>'.$price.'</strong><br>';
$i++;
}
$count = count($content);
for($i=1; $i<$count; $i++) {
$query = "UPDATE products SET price = $price WHERE model = '$checkmodel'";
$update = mysql_query($query) or die(mysql_error());
if($update) {
echo 'Updated Price of Model: <strong>'. $checkmodel.'</strong> To £<strong>'.$price.'</strong><br>';
}
else {
echo '<b>DID NOT UPDATE</b>';
}
//change $price and checkmodel here
}
For other type of SQL statements, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success or FALSE on error.
Good luck. Sorry about my last post ;)