MYSQL和PHP连接数据库时没有问题,但在发布到数据库时会出现问题

$sql = "INSERT INTO 'testdatabase`.`newuserformtable' (`First Name`,`Last Name`, `Title`)
VALUES ('John', 'Doe', 'john@example.com')";

 if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();

I've tried everything and I still get this error message:

Connected successfullyError: INSERT INTO 'testdatabase`.`newuserformtable`(`First Name`, `Last Name`, `Title`) VALUES ('John', 'Doe', 'john@example.com')
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''testdatabase`.`newuserformtable' (`First Name`, `Last Name`, `Title`) VALUES ' at line 1 

The problem was with your single quotes (') and back-ticks (`) in your query. Try using this below, I could not put it in comment

INSERT INTO `testdatabase`.`newuserformtable` ...

It seems error with single quote you mixed with

$sql = "INSERT INTO `testdatabase`.`newuserformtable' (`First Name`,`Last Name`, `Title`)
VALUES ('John', 'Doe', 'john@example.com')";

$sql = "INSERT INTO testdatabase.newuserformtable' (First Name,Last Name,Title`) VALUES ('John', 'Doe', 'john@example.com')";

write like this problem with your quotes.....and also checkdatatype and length if there is another error post your error

Database name or table name should not be considered as a string.

so the sql should be :

INSERT INTO testdatabase.newuserformtable (`First Name`,`Last Name`, `Title`)
VALUES ('John', 'Doe', 'john@example.com');

You used a single quote(') instead of a backtick(`) on the database and table name.

$sql = "INSERT INTO `testdatabase`.`newuserformtable`
            (`First Name`,`Last Name`, `Title`)
        VALUES
            ('John', 'Doe', 'john@example.com')";
$sql = "INSERT INTO `testdatabase`.`newuserformtable'
       (`First Name`,`Last Name`, `Title`)
       VALUES 
       ('John', 'Doe', 'john@example.com')";

$res = mysql_query($sql);

if ($res) {
    echo "New record created successfully";
} 
else {
    echo "Error";
}