I'm getting this SQL error:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INSERT INTO `tsv` (`Id`,`Date`,`Quantity`) VALUES( `1`,`2009-07-01`,`174`, `1`,`' at line 9
I'm not really experienced in SQL queries and i really can´t see whats wrong here... I tried replacing "`" with "'". And also removing "ENGINE=MyISAM" as I'm not sure thats the engine I'm using.
CREATE TABLE IF NOT EXISTS `tsv`
( `_id` int(11) NOT NULL AUTO_INCREMENT,
`Id` text NOT NULL, `Date` text NOT NULL,
`Quantity` text NOT NULL, PRIMARY KEY (`_id`) )
ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=68 ;
INSERT INTO `tsv` (`Id`,`Date`,`Quantity`)
VALUES( `1`,`2009-07-01`,`174`, `1`,`2009-07-02`,`96`,
`1`,`2009-07-03`,`271`, `1`,`2009-07-04`,`335`, `1`,
`2009-07-06`,`72`, `1`,`2009-07-07`,`246`, `1`,`2009-07-08`,
`93`, `1`,`2009-07-09`,`191`, `1`,`2009-07-10`,`136`, `1`,
`2009-07-11`,`200`, `1`,`2009-07-13`,`151`, `1`,`2009-07-15`,`99`);
And the PHP:
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
if ($conn->query($sqlContent) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sqlContent . "<br/>" . $conn->error;
}
$conn->close();