inserting but not updating

admin

Administrator
Staff member
hiya i have a script that's ment to take user input and add to data base, then display all the data in a form allowing the user to make any changes he/she needs to and then update the DB entry the problem is it creates a new record instead of updating ...

Below is a copy of all my php coding..

Many Thanks inadvance

Peter

<? my db connect info


if ($submit){

$result = mysql_query("INSERT INTO app (name,company,address,suburb,state,post,areacode,phone,faxareacode,fax,email,secret) VALUES ('$name','$company','$address','$suburb','$state','$post','$areacode','$phone','$faxareacode','$fax','$email','$secret')");

if($name){
$result="SELECT * FROM app WHERE id=$id";
if ($submit){

$result ="UPDATE app SET name='$name',company='$company',address='$address',suburb='$suburb',state='$state',post='$post',areacode='$areacode',phone='$phone',faxareacode='$faxareacode',fax='$fax',email='$email',secret='$secret' WHERE id=$id";
}
$result = mysql_query($rs);

?>

the update form

<?
}
}
else {
?>
initial form
<?
}
?>
 
Back
Top