Location: PHPKode > scripts > ZBase > zbase/html/delete_result.php
<?
/*****************************************************************************
 * delete_result.php : Processes ZBase delete form
 *****************************************************************************
 * $Id: delete_result.php,v 1.2 2000/08/11 15:16:43 massiot Exp $
 *****************************************************************************
 *  ZBase - a gateway between the database and the WWW
 *  Copyright (c) 1999 The ZBase team
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *****************************************************************************/

require("srv_html.inc");
srv_init();
srv_header(srv_str("html", "delete_result_title"));

/* Use a form object to retrieve the properties of the tables we work on. */
$form = new form;

if ($form->form_getnb() != 1) {
  $THEME_OBJ->th_error(srv_str("html", "wrong_parameters")
                       ." (delete_result.php)");
  srv_close();
  exit;
}

/* Use a result object to show the results. */
$RESULT_OBJ = new result;
$RESULT_OBJ->rlt_begin();

$attributes = $form->form_getobj();
srv_include($attributes["name"]);
$root = new $attributes["name"];
$root->search($attributes["keys"]);
$root->search_fetch_array(0);

$root->delete();

$RESULT_OBJ->rlt_addroot($root->result_id);

$RESULT_OBJ->rlt_end();

if ($SESSION_OBJ && ($link = srv_retrieve("search_page")))
  echo "<center><a href=\"".$link."\">"
       .htmlentities(srv_str("html", "previous_search"))
       ."</a></center>";

if (!$ZB_ERROR) {
    $root->delete_afterresult();
}

srv_close();
?>
Return current item: ZBase