在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.

You can't use single quotes to specify field or table names, you must use backticks. The correct MySQL query would be:

Insert into `testtable` (`Tool`,`Request Date`) values('selenium','2015-6-6')

try this,

$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') ";
            $result = mysqli_query($db,$sql);

            print_r($result);

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