<?php
include("common.php");
if($_POST["submit"])
{
echo $sql="insert into message (id,username,title,password,sex,content,lastdate) values ('', '$_POST[username]','$_POST[title]','$_POST[password]','$_POST[sex]','$_POST[content]',now())";
}
?>
include("common.php");
if($_POST["submit"])
{
echo $sql="insert into message (id,username,title,password,sex,content,lastdate) values ('', '$_POST[username]','$_POST[title]','$_POST[password]','$_POST[sex]','$_POST[content]',now())";
}
?>
解决方案 »
- 中文乱码问题:帮忙看一下是哪里出错了,谢谢了
- Discuz底部信息怎么修改?
- 求教一个php页面样式丢失的问题
- 一个简单的数组排序问题,求解!
- 这种功能怎么写
- 如何友好的提示错误?
- 请问:我用php4+apache2+mysql 做的网页,怎么把数据库和设置上传到网站呀?
- 请帮看看问题出哪里了?
- PHP里是怎样来刷新聊天记录的,是不是用<meta http-equiv="refresh" content="5; url='#End'">,为什么我有些机器行,有些机器不行,是不
- 那里有支持php+mysql的免费空间或者asp+access??国内国外都可以
- 桌面搜索不能索引php文件内容?
- 如果输入全部是特殊字符 该怎么处理
include("common.php");
if($_POST["submit"])
{
echo $sql="insert into message (id,username,title,password,sex,content,lastdate) values (\"\",\"{$_POST[username]}\",\"{$_POST[title]}\",\"{$_POST[password]}\",\"{$_POST[sex]}\",\"{$_POST[content]}\",now())";
}
?>
所以上面的SQL语句写成:
<?php
include("common.php");$username = $_POST['username'];
$title = $_POST['title'];
$password = $_POST['password'];
$sex = $_POST['sex'];
$content = $_POST['content'];
$lastdate = now();
//id一般是自增的,不用显式指定
if($_POST["submit"])
{
echo $sql=insert into message (username,title,password,sex,content,lastdate) values ("$username","$title","$password","$sex","content","$lastdate");
}
?>
echo $sql="" //后面要加到引号里