This topic is locked

Update another table

9/27/2009 1:08:15 PM
PHPRunner General questions
U
uzu1302 author

Hello,

I have 2 tables: Offre and Archive

fields of the table Offre:

id_Of

Fournisseur

Pays

...
fields of the table Archive

id_Of

Fournisseur

Pays

.....

When I change the table fields Offre I want to update the fields in the Archive table.

I used: function AfterEdit ...

global $conn, $numID;

$numID = $_SESSION["id_Of"];

$strSQLExists = "select * from archive where id_Of = "$numID"";

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);

if($data)

{

$sql = "update archive set id_Of=".$values["id_Of"]."Fournisseur=".$values["Fournisseur"]";

}
I can not!

Thank you for your help

Patrick

J
Jane 9/28/2009

Patrick,
entered values are stored in the $values array.

Here is just a sample code:

global $conn;

$sql = "update archive set Pays='".$values["Pays"]."', Fournisseur='".$values["Fournisseur"]."' where id_Of=".$keys["id_Of"];

db_exec($sql,$conn);