Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE),
Guys I'm having a problem with inserting my datas to my database. I
already checked the column names and they're correctly spelled.
<?php
//connecting to database and verifying student number and 6-pin code
inputted by the user.
$username = "root";
$password = "";
$hostname = "localhost";
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password) or die("Unable
to connect to MySQL");
//echo "Connected to MySQL<br>";
echo '<a href="login.php"><u>Go Back</u></a>';
//select a database to work with
$selected = mysql_select_db("enrollment", $dbhandle) or die("Could not
select enrollment");
//adding values
$addSub = "INSERT INTO subject
VALUES($_POST['subject_id'],$_POST['subject_desc'],$_POST['subject_units'],$_POST['subject_price'])";
mysql_query($addSub);
mysql_close($dbhandle);
?>
I get this error:
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE),
expecting identifier (T_STRING) or variable (T_VARIABLE) or number
(T_NUM_STRING) in C:\xampp\htdocs\user\add.php on line 18
No comments:
Post a Comment