i have created a database on a temp site and i am making a form where uses can add or update information to the database that will then be displayed on a page in the site. Here is the code for the form:
<form action="leaderboard.php" mehtod="POST" />
<p>Points:
<input type="text" name="Points"/>
<br>
First Name:
<input type="text" name="First Name"/>
<br>
Last Name:
<input type="text" name="Last Name"/>
<br>
</p>
<input type="submit" value="Submit">
<p> </p>
And here is the PHP Script to upload the information to the database.
<?PHP
define('db_name', 'webadmin_leaderboard');
define('db_user', 'webadmin');
define('db_password', 'collide198');
define('db_host', "localhost");
$link = mysql_connect(db_host, db_user, db_password);
if (!$link) {
die('Could Not Connect: ' . mysql_error());
}
$db_selected = mysql_select_db(db_name, $link);
if (!$db_selected) {
die('can\'t use' . db_name . ': ' . mysql_error());
}
echo 'Connected Successfully';
$value = $_POST['Points'];
$sql = "INSERT INTO leaderboard (Points) VALUES ('values')";
$value = $_POST['First Name'];
$sql = "INSERT INTO leaderboard (First Name) VALUES ('values')";
$value = $_POST['Last Name'];
$sql = "INSERT INTO leaderboard (Last Name) VALUES ('values')";
if (!mysql_query($sql)) {
die('Error: ' . mysql_error());
}
mysql_close();
?>
However, i keep getting a sytax error that reads:
Connected SuccessfullyError: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Name) VALUES ('values')' at line 1
Please help me! Its driving me crazy and i know its probably one small little detail im missing.