//$update = $_POST;
//$quantity = $_POST;
mysql_query ("UPDATE productorder SET Product_quantity = '$quantity' WHERE id = '$id'");


Member Avatar

what's MULITY?

Member Avatar

Sorry I still don't understand what you mean by 'mulity' - I Googled it and couldn't find it.

//$update = $_POST['update'];
//$quantity = $_POST['quantity'];
mysql_query ("UPDATE productorder SET Product_quantity = '$quantity' WHERE id = '$id'");

This doesn't do anything does it? Your loop is commented out and your $id seems to be static. Odd.

i have 3 row(records) in database table like
id order quantity
1 2232 1
2 2232 1
3 2232 1
they pick the last row(records)
id order quantity
3 2232 1
and update
how i update the i and 2 rows(records)

Member Avatar

show your complete code -it's impossible to see what you're doing from the bit you included. You don't include a loop so I assume it is impossible to update all unique 'id' records otherwise.

// ********** update ************ 
mysql_connect("$hostname_boss", "$username_boss", "$password_boss")or die("cannot connect");
mysql_select_db("$database_boss")or die("cannot select DB");
$sql="SELECT * FROM productorder";

$update = $_POST['update'];
$quantity = $_POST['quantity'];
$id = $_POST['id'];
$insert="UPDATE productorder SET Product_quantity = '$quantity' WHERE id = '$id'";  
$result1 = mysql_query($insert);
echo "<meta http-equiv=\"refresh\" content=\"0;URL=shoping_cart12.php\">";


Member Avatar

first of all, you've included a meta refresh inside the loop. Don't do this. I'd use header() after the loop.

You're tables confuse me. I don't understand why you want to get the count of your orders and then loop over your insert statement that number of times.

UPDATE productorder SET Product_quantity = '$quantity' WHERE id = '$id'

This will only ever update one record as it is unique (I assume the id is a primary key).

I'm thinking that you've misunderstood what you're trying to do.

$update = $_POST;
$quantity = $_POST;
$id = $_POST;

$insert1="UPDATE productorder SET Product_quantity = '$quantity' where product_id = '$id'";
$result1= mysql_query($insert1);
// if successful redirect to delete_multiple.php
echo "<meta http-equiv=\"refresh\" content=\"0;URL=shoping_cart.php\">";

no dear they only pick the last record and update it
2 problem they continuously refresh the page
how i can i time refresh the page

Member Avatar

Sorry, I don't understand. Your code above should work. If you want to 'time refresh the page', do you mean pause for a while then refresh? If so:

header('Refresh: 5; URL=http://www.example.com');
<p>You will be redirected in 5 seconds...</p>