php写入数据库

WBOY
Release: 2016-06-23 14:29:18
Original
1579 people have browsed it


include_once 'Conn.php';
if($_POST['Submit']){
$sql = "insert into guestbook (ID,userName,title,content,lastdate) values  (NULL,'$_POST[userName]','$_POST[title]','$_POST[content]',now())";
echo $sql;
mysql_query($sql);
echo "成功";
}
?>


 
 
 
 

 

Conn.php


$conn=@mysql_connect("localhost","root","") or die ("连接错误");//数据库连接
mysql_select_db("newDB",$conn);//
mysql_query("SET NAMES gbk");
?>

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template