Can someone please look through my php code and see what is wrong. I'm trying to make a simple update form.
I'm quite new to php so please excuse me if I've made some obvious error but can't recorgnize it.
First i'm seding the updated data using
<form action="update.php?type=update&ref=<?php echo $row['ref'] ?>" method="post">
and here is my update.php file
<?php
if ($type == "update"){
$pwd = 'xxx';
$db = mysql_connect ("xxxx", "xxxx", $pwd);
if (!$db){
print "Erreur connection $db, informer le webmaster.<br>";
exit;
}
if (!mysql_select_db ("anydb", $db)){
print "Erreur " . mysql_error() . ", informer le webmaster.<br>";
mysql_close($db);
exit;
}
}
$type = @$_POST['type'];
if($type == "update"){
$sql = "UPDATE biens SET vendu='$vendu',affiche='$affiche',suivi='$suivi',fa='$fa',tel='$tel',telport='$telport',refmandat='$refmandat',datemandat='$datemandat',typemandat='$typemandat',obs='$obs' WHERE ref='$ref'";
$result = mysql_query ($sql);
if (!$result){
print "erreur $sql <br>";
exit;
}
?>
I'd be very thankful if someone helps me with this...