<?php
// This page add an entry in the table news
// When called set_* or get_*, * means the name of the table field
// You have to connect to the mysql base yourself
require_once "news.table.class.php";
$news=new news();
$news->set_title("Hello");
$news->set_content("World!");
$news->save();
//This page can also update a row if the primary key is specified
if(isset($_GET['id'])){
$news=new news();
$news->set_id(addslashes($_GET['id']));
$news->set_title("Hello");
$news->set_content("New World!");
$news->save();
}
//And delete an entry
if(isset($_GET['id']) && isset($_GET['delete'])){
$news=new news();
$news->set_id(addslashes($_GET['id']));
$news->delete();
}
?>
|