<?php
if ($submit) {
// here if no ID then adding else we're editing
if ($id) {
$sql = "UPDATE reseller SET areaid='$areaid',agentnum='$agentnum',managerid='$managerid',title='$title',firstname='$firstname',lastname='$lastname',photo='$photo',telwnum='$telwnum',faxnum='$faxnum',cellnum='$cellnum',email='$email',status='$status' WHERE ID=$id";
// run SQL against the DB
$result = mysql_query($sql);
$sql = "UPDATE area SET status='TRADING' WHERE areaid=$areaid";
// run SQL against the DB
$result = mysql_query($sql);
} else {
$sql = "INSERT INTO reseller (areaid,agentnum,managerid,title,firstname,lastname,photo,telwnum,faxnum,cellnum,email,status) VALUES ('$areaid','$agentnum','$managerid','$title','$firstname','$lastname','$photo','$telwnum','$faxnum','$cellnum','$email','$status')";
// run SQL against the DB
$result = mysql_query($sql);
$sql = "UPDATE area SET status='TRADING' WHERE areaid=$areaid";
// run SQL against the DB
$result = mysql_query($sql);
}
?>
The above is my code and i WANT to update two tables in one go.
Table one is the Reseller.
Table two is the Area.
Once a new applicant apply for a vacant area I need to add him to the reseller table and
Change the status in the area table from available to TRADING.
The reseller add and edit work but not the rest.
any comments.