- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
<?php
//Данные на базу
$lnk = mysql_connect('localhost', 'mysql_user', 'mysql_password')
or die ('Not connected : ' . mysql_error());
mysql_select_db('primecms_db', $lnk) or die ('Can\'t primecms_db foo : ' . mysql_error());
class insert{
var $pid, $alias, $text, $position, $status, $create_time, $modify_time;
}
function con_in($alias, $text_en, $text_ru, $text_descr){
$res = new insert;
$res->pid=1;
$res->alias=addslashes($alias);
$res->text='<p>'.addslashes($text_en).'</p>\r\n<p>'.addslashes($text_ru).'</p>\r\n<p>'.addslashes($text_descr).'</p>';
$res->position=0;
$res->status=1;
$res->create_time=time();
$res->modify_time=time();
return $res;
}
if ($_POST['send']){
$con = con_in($_POST['alias'],$_POST['text_en'],$_POST['text_ru'],$_POST['text_descr']);
mysql_query("INSERT INTO e118_glossary_items (`id`, `pid`, `alias`, `text`, `position`, `status`, `create_time`, `modify_time`) VALUES (".$con->pid.",'".$con->alias."','".$con->text."',".$con->position.",".$con->status.",".$con->create_time.",".$con->modify_time.")");
}
?>
<form name="" action="" method="post">
Alias<input name="alias" size=30 type="text" value=""><br />
text_en<input name="text_en" size=30 type="text" value=""><br />
text_ru<input name="text_ru" size=30 type="text" value=""><br />
text decr<textarea name="text_descr" rows=7 cols=50 wrap="off"></textarea><br />
<input type="submit" value="Send" name="send"><br />
</form>
guest 04.03.2009 18:02 # 0
прогллядел... вот это "`id`, " надо убрать из строчки