Hello Coopster, I am back after so many years (Was henry0)
I can't feed my DB with the following script
I did echo every values, no problen there, an error is said to happen at
<<
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 '-ingredient, nbrpers, ingredients, methode) values(''', '', '', '', '', '')' at line 1 in C:\xampp\htdocs\RCP\rcp-form\post-rcp.php:81 Stack trace: #0 C:\xampp\htdocs\RCP\rcp-form\post-rcp.php(81): mysqli_query(Object(mysqli), 'INSERT INTO rcp...') #1 {main} thrown in
>>
athough I connect sucessfully
CODE
$conn = mysqli_connect($servername, $username, $password, $db);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
} else
{
echo "Connected successfully";
}
$sql = "INSERT INTO rcp (cate, titre, main-ingredient, nbrpers, ingredients, methode)
values('$cate'', '$titre', '$mainingredient', '$nbrpers', '$ingredients', '$methode')";
XXX Here is said to be the problem
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
By advance thanks all