- 论坛徽章:
- 0
|
快晕了,网上的代码都试了就是不能插入数据库呢,快晕死了。看偶写的代码就是增加不到数据库里面去。
- //<?php
- // require("localhost.php");
- // ?>;
- <?php
- printf("今天时间:%s",$_POST[date]);
- echo "<br>;";
- printf("开始时间:%s",$_POST[time1]);
- echo "<br>;";
- printf("拨打电话:%s",$_POST[phone]);
- echo "<br>;";
- printf("接通时间:%s",$_POST[time2]);
- echo "<br>;";
- printf("中间过程:%s",$_POST[finsh]);
- echo "<br>;";
- printf("最终结果:%s",$_POST[result]);
- echo "<br>;";
- printf("礼貌程度:%s",$_POST[beizhu]);
- echo "<br>;";
- $db = mysql_connect("localhost", "root","123456");
- mysql_select_db("my",$db);
- if (
- $_POST[date] == ""
- || $_POST[time1] == ""
- || $_POST[phone] == ""
- || $_POST[time2] == ""
- || $_POST[finsh] == ""
- || $_POST[result] == ""
- ){
- echo "<a href=javascript:history.back(1)>;填写不完整啊,这样怎么可以呢.</a>;\n";
- }
- else {
- $db1=("insert into kefu(date,time1,phone,time2,finsh,result,beizhu) values('$_POST[date]','$_POST[time1]','$_POST[phone]','$_POST[time2]','$_POST[finsh]','$_POST[result]','$_POST[beizhu]')");
- $result=mysql_db_query( $db1,$db);
- if($result){echo "<script>;alert('发布成功');</script>;";}
- else {echo "错了!\n";trigger_error(mysql_error(),E_USER_ERROR);}
- }
- ?>;
复制代码 |
|