dsvtnz6350
2015-01-21 10:07
浏览 79
已采纳

在xampp服务器上运行的mysql中的数据表中插入/更新

            $db= mysqli_connect('localhost',$user, $pass, $dbname);

            if (!$db) {
                die("Connection failed: " . mysqli_connect_error());
            }
            $sql="Insert into 'testtable' ('Tool','Request Date') values('selenium','2015-6-6') ";

the above code is for inserting a row in sql table running on xampp.

table has 3 fields id(primary key/auto inc.),date and tool.

for some reason the the code is not working.

I am getting no particular error .

$result = mysqli_query($db,$sql);

                print_r($result);

                if ($result) {
                       echo "success";
                } else {
                       echo "failed";
                }

only "failed" in printed in console,web browser etc.

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题