The Barbados Yachting Association
Database Delete: Results
/* input is $id, $name */
$id = strtoupper($id);
$chars = strlen ($id);
$database="boats"; $table="yachts";
$calling_url = "http://localhost/~rhill/yachts/delete.phtml";
$start_url = "http://localhost/~rhill/yachts/index.phtml";
if ($calling_url);
>
Return to database input form
Return to database home page
endif;
echo "
\n";
SetType($query, "string"); /* force string for overloaded ops */
$query = "id=" + "'"+ $id + "'";
/* Check for existence */
$result = mysql($database,"select * from $table where $query");
$num = mysql_numrows($result);
if ( $num == 0);
echo "Does Not Exist!
\n";
else;
mysql_FreeResult($result);
$result = mysql($database,"delete from $table where id ='$id'");
if ( $result == 0 );
echo "Successfully deleted identifier $id
";
mysql_FreeResult($result);
else;
echo "Delete failed
";
endif;
endif;
>