Hi all,
Can anyone tell me how to correct this script. Being new to PHP i can't get the else statements to work properly.
Here is the script:
<?php
include("include/dbconnect.php");
if($submit)
{
$sql = "INSERT INTO $table (CatID, CatParent, CatName, address, suburb, state, post_code, phone, Info, url, picture, map_ref, map_pic_thumb, map_pic_detail) VALUES ('$CatParent','$CatID','$address','$suburb','$state','$post_code','$phone','$Info','$url','$picture','$map_pic_thumb','$map_pic_detail')";
$result = mysql_query($sql);
if($result)
echo "<br><br>Information entered into database.\n";
} else {
echo "<br><br>Error: Data could not be added.\n";
}
else if($update)
{
$sql = "UPDATE $table SET CatID='$CatID',CatParent='$CatParent',CatName='$CatName',address='$address',suburb='$suburb',state='$state',post_code='$post_code',phone='$phone',Info='$Info',url='$url',picture='$picture',map_pic_thumb='$map_pic_thumb',map_pic_detail='$map_pic_detail' WHERE CatID=$CatID";
$result = mysql_query($sql);
if($result)
echo "<br><br>Information updated.\n";
}
else if($id)
{
$result = mysql_query("SELECT * FROM $table WHERE CatID=$id",$db);
$myrow = mysql_fetch_array($result);
?>