View Full Version : Php Calendar Help

04-11-2004, 11:52 AM
Im new to this and iv been working with a php calendar. I need some help in explaing the functions on my event_delete.php page.I be grateful if somebody could comment my code so i have an understanding what is happening.Sorry for asking but iv spent days trying to understand it and im getting nowhere.

Alan Hogan

Function remove_event($id)
Function delete_event()


function remove_event($id)
global $db;

$result = $db->sql_query('DELETE FROM '.SQL_PREFIX
."events WHERE id = '$id'");
if(!$result) {
$error = $db->sql_error();
soft_error("SQL error $error[code]: $error[message]");

if($db->sql_affectedrows($result) > 0)
return true;
return false;

function delete_event()
global $QUERY_STRING, $config, $vars;
if(!check_user() && $config['anon_permission'] < 2) {
soft_error('You do not have permission to delete events.');

$del_array = explode('&', $QUERY_STRING);

$output = "<div class=\"box\" style=\"width: 50%\">\n";

$selected = 0;
$id = $vars['id'];
if(remove_event($id)) {
$output .= _('Removed item').": $id<br />\n";
} else {
$output .= _('Could not remove item').": $id<br />\n";

return $output . "</div>\n";