I am trying to add data to a Mysql database with php. I am connected to the database but the data is not being inserted into the table. Here is my code and thank you in advance!
<?php
ob_start();
include("db.php");
if(isset($_POST['send'])!="")
{
$sql = "INSERT INTO `Scouting`(`Team #`,`High Goal Made`,`High Goal Missed`)
VALUES(`$username`,`$usermail`,`$usermobile`)";
$username=mysql_real_escape_string($_POST['Team #']);
$usermail=mysql_real_escape_string($_POST['High Goal Made']);
$usermobile=mysql_real_escape_string($_POST['High Goal Missed']);
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
if($update)
{
$msg="Successfully Updated!!";
echo "<script type='text/javascript'>alert('$msg');</script>";
header('Location:index.php');
}
else
{
$errormsg="Something went wrong, Try again";
echo "<script type='text/javascript'>alert('$errormsg');</script>";
header('Location:index.php');
}
}
ob_end_flush();
?>