手动写的连接数据库去掉注释符可以运行,但我想用调用的方法就是无法调用include/common.inc.php晕死求助啊
<?php
require_once(dirname(__FILE__)."/../include/common.inc.php");
 /* $link=mysql_connect("localhost","root","");
    mysql_query("set names 'gbk'");  
    mysql_select_db("zynk2");  */
$username=$_POST["username"];
$age=$_POST["age"];
$phone=$_POST["phone"];
$date=$_POST["date"];
$xiangmu=$_POST["xiangmu"];
$bingqing=$_POST["bingqing"];$tsql="insert into dede_diyform1(username,age,phone,date,xiangmu,bingqing) values('$username','$age','$phone','$date','$xiangmu','$bingqing')";$trs=mysql_query($tsql);
echo"$trs";
if($trs){
           echo "信息已被添加到数据库";
     }
     else{
         echo "信息没被添加";
      }?>

解决方案 »

  1.   

    echo dirname(__FILE__)."/../include/common.inc.php";
    看看文件路径是否正确
      

  2.   

    输出时这个这是什么情况D:\wamp\www\diyform1/../include/common.inc.php
      

  3.   

    那你贴出 common.inc.php 文件的全路径
      

  4.   

    我改成了require_once("localhost/include/common.inc.php");
    Warning: require_once(localhost/include/common.inc.php) [function.require-once]: failed to open stream: No such file or directory in D:\wamp\www\diyform1\diyform1.php on line 3Fatal error: require_once() [function.require]: Failed opening required 'localhost/include/common.inc.php' (include_path='.;C:\php5\pear') in D:\wamp\www\diyform1\diyform1.php on line 3
    。T.T
      

  5.   

    应该是路径的问题,你把路径写为绝对地址试试。
    D:\wamp\www\diyform1\include\common.inc.php
    你的文件应该是这个路径把
      

  6.   


    Warning: include(D:\wamp\www\diyform1\include\common.inc.php) [function.include]: failed to open stream: No such file or directory in D:\wamp\www\diyform1\diyform1.php on line 2Warning: include() [function.include]: Failed opening 'D:\wamp\www\diyform1\include\common.inc.php' for inclusion (include_path='.;C:\php5\pear') in D:\wamp\www\diyform1\diyform1.php on line 2
    改了后变这样了我曰啊这什么回事第一次碰这种情况
      

  7.   

    说下你的目录结构,include 是在 diyform1 目录下吗
      

  8.   

    不是是在根目录下的\diyform1\diyform1.php但common.inc.php是在include下
      

  9.   

    require_once("./include/common.inc.php");
      

  10.   

    require_once("./include/common.inc.php");
      

  11.   

    绝对路径怎么下载www/include/common.inc.php下