1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
<?php require("configure.php"); ?> <? $newsId = $_POST["newsId"]; $newsdate = htmlspecialchars($_POST["newsdate"],ENT_QUOTES); $newsdesc = preg_replace("/'/","\'",$_POST["newsdesc"]);
$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, newsdesc) values ('$newsId', '$newsdate', '$newsdesc')"; //echo $sql; mysql_query($sql); mysql_close($dbh);
header("Location: newsindex.php?msg=Add Successful"); ?>
|