Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 1392 → Rev 1393

//asterisk-stats/trunk/telbook_export_update.php
0,0 → 1,40
<?php
 
include_once('includes/common.php');
Prolog();
 
if(array_key_exists('delete', $_POST)) {
$id = $_POST['id'];
$db->begin_transaction();
$db->query_params("delete from telbook_categories_export where export_id=$1", array($id));
$db->query_params("delete from telbook_entries_export where export_id=$1", array($id));
$db->query_params("delete from telbook_export where export_id=$1", array($id));
$db->commit_transaction();
 
header("Location: telbook_export_list.php");
$g_display->add_text('Information deleted successfully');
}
elseif(array_key_exists('update', $_POST)) {
$id = $_POST['id'];
$export_name = $_POST['export_name'];
$export_comment = $_POST['export_comment'];
 
if($id) {
$db->query_params("update telbook_export set"
. " export_name=$2, export_comment=$3"
. " where export_id=$1",
array($id, $export_name, $export_comment));
}
else {
$db->query_params("insert into telbook_export"
. " (export_name, export_comment) values ($1, $2)",
array($export_name, $export_comment));
}
 
header("Location: telbook_export_list.php");
$g_display->add_text('Information saved successfully');
}
 
Epilog();
 
?>