I'm trying to insert data into my MySQL table, but with no luck. My code looks like:
$mysqli = mysqli_connect("localhost","login info");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
if (isset($_POST['submit'])) {
$number = $_POST['number'];
$road = $_POST['road'];
$postcode=$_POST['postcode'];
$price=$_POST['price'];
$type=$_POST['type'];
$bedrooms=$_POST['bedrooms'];
$agent=$_POST['agent'];
$featured=$_POST['featured'];
$keywords=$_POST['keywords'];
$mysqli->query("
INSERT INTO listings-rent
(number, road, postcode, price, type, bedrooms, agent, featured, keywords)
VALUES
('$number','$road','$postcode','$price','$type','$bedrooms','$agent','$featured','$keywords')");
}
The connection is fine, returns no errors.