关于$sql的插入语句 sql 语句应该是一个字符串,你这个明显是语法错误~~~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 "$_POST[username]"这类属于字符类型的改为'".$_POST['username']."'这样试试:$sql = insert into `message (id,username,title,password,sex,content,lastdate) values('','".$_POST['username']."','".$_POST['title']."','".$_POST['password']."','".$_POST['sex']."','".$_POST['content']."',now());` 我帮你改正了,自己看看那里不一样吧<?phpinclude("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())";}?> 呵呵,严重的格式错误。用楼上的和我回答的都可以。<?phpinclude("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())";}?> 还有,数组的索引需要引号括住。(根据http://topic.csdn.net/u/20090208/17/38d220f6-bdf7-41b3-866c-03615cc9ab3f.html3楼的提醒)最终代码:<?phpinclude("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())";}?> PHP加载ATL工程的COM,如何进行调试? 问一个关于GD库安装的问题 PHP 5.3 register_globals Warning 如何去掉? php与javascrip编码解码问题,求解..... CSDN传统,升星散分 [求助]大龄新手请前辈们推荐几本参考书 文件下载这段代码哪里出问题了? apache的问题 求助:谁有ultra edit的注册号?谢谢! 各位高手,能不能告诉我关于几个常用的session函数的用法??非常急!!在线等!! php5操作oracle9i中文数据出现乱码 散分,我升星了,变成专家了
这样试试:
$sql = insert into `message (id,username,title,password,sex,content,lastdate) values('','".$_POST['username']."','".$_POST['title']."','".$_POST['password']."','".$_POST['sex']."','".$_POST['content']."',now());`
<?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())";
}
?>
呵呵,严重的格式错误。用楼上的和我回答的都可以。
<?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())";
}
?>
<?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())";
}
?>