School project where i need to enter info in html input to get data in database, but for some reason i wont transfer data into db and says that mysqli_query fails (not the error message, its echo in last if statement).
<?php
if (isset($_POST['submit'])) {
$name = $_POST['name'];
$team = $_POST['team'];
$points = $_POST['points'];
$host = "localhost";
$username = "admin";
$password = "admin";
$db = "seminarski";
$conn = new mysqli($host, $username, $password, $db);
if (!$conn) {
die("Connection failed!" . mysqli_connect_error());
echo "Connection fail";
}
$query = "INSERT INTO f1_tabela (racename, team, points) VALUES ($name, $team, $points)";
$run = mysqli_query($conn, $query);
echo "Connected// ";
if ($query) {
echo $name;
echo $team;
echo $points;
echo "// Info filled //";
}
if ($run) {
echo " Success //";
}
mysqli_close($conn);
echo " Fail //";
}
?>