Update data problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there, I hoped someone might be able to tell me why this is not
working.
 
 
I have a form that updates the table 'media' with the 3 values below,
that and some other variables are the only data in the table. That works
nicely. 
 
I then want to update one of the other columns ($E) based on the data
I've just submitted - that is the multiplication of the two variables. I
then want to input this variable back into the table. What happens is
that the new values are used ($C), but the original value in the table
($G) is ignored. Why is this? I would have thought it was pretty
straight-froward to extract 2 values from a table, multiply them
together and then input it back as a new variable.
 
Thanks
Justin
 
if($update)
                   
{

mysql_pconnect("localhost","root","password");
mysql_select_db("options");
 

$query = "UPDATE media SET A='$A', B='$B', C='$C'";
$result = mysql_query($query);
 
$query = "SELECT C, G FROM media";
$result = mysql_query($query);
 
$E= "$C*$G";

 
$query = "UPDATE media SET E='$E'";
$result = mysql_query($query);

}
 

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux