echo $querys;
然后你就什么都明白了。

解决方案 »

  1.   

    $querys="INSERT INTO pub(title,content,pubdate,uid) values ( '".$title."', '".$content."',now(),".$user.")"; 
      

  2.   

    Fatal error: Call to a member function free() on a non-object in D:\xampp\htdocs\exec\data\add.php on line 16
    按照楼上的解决办法,然后自己又修改了一些东东,现在可以了,但在执行完后执行$result- >free(); 
    $conn- >close(); (参上面代码),提示上面的提示.再求
      

  3.   

    楼上的可能误会了,now()是属于sql语句的一部分,不是吗?所以这跟php没有关系的.
      

  4.   

    你的数据库类里没有定义 free() 函数
      

  5.   

    我用的是php的mysqli扩展,并且在我的电脑里这个扩展是打开的.所以应该可以使用吧!
      

  6.   

    <?php
    require_once('inc.php');
    // receive the data from data.php and save them to database;
    //asign value to each var
    $title=$_POST['title'];
    $user=(int)$_POST['uid'];
    $content=$_POST['content'];//add them to db
    $mysqli=new mysqli();
    $mysqli->connect($server,$uname,$pwd,$db); 
    $querys="INSERT INTO pub(title,content,pubdate,uid) values ('".$title." ','".$content." ',now(),".$user.")"; 
    echo $querys;
    $result=$mysqli->query($querys);
    if($result) echo "insert successfully <a href='data.php'>返回</a>";
    $result->free();
    $mysqli->close();
    ?>
    这是add.php的完整代码,为什么会出现
    Fatal error: Call to a member function free() on a non-object in D:\xampp\htdocs\exec\data\add.php on line 16 的提示呢
    在其他页面也调用了free() close(),但可以的
      

  7.   

    你运行 echo $query;  看看 语句 比如说 select *  from books  whereid=001就错了 应该是 select * form books where id=001 是因为在输入查询或插入语句时没有在where后面加空格