1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<?php require("configure.php");
$newstitle = htmlspecialchars($_POST["newstitle"],ENT_QUOTES); //$newsdesc = $_POST["newsdesc"]; $newsdesc = preg_replace("/'/","\'",$_POST["newsdesc"]); $newsdate = date("Y-m-d H:i:s"); //print_r($_POST);
$sql = "select max(newsid) as maxid "; $sql .= "from news "; $result=mysql_query($sql); $row = mysql_fetch_array($result,MYSQL_ASSOC); $newsid = $row{maxid}+1;
$sql = "insert into news (newsid, newsdate, newstitle, newsdesc, newsstatus) values ('$newsid', '$newsdate', '$newstitle', '$newsdesc', '0')"; mysql_query($sql); if( mysql_errno() > 0 ){ echo 'News Add:<br />'. mysql_error() .'<br />SQL: '. $sql; exit; }
mysql_close($dbh);
header("Location: news_index.php?msg=Update Successful"); ?>
|