|
Answer» below is my code can anyone help me with this error:
Parse error: syntax error, unexpected T_STRING in C:\wamp\www\cssonline\confirm.php on line 28
$HOST = "localhost"; $USER = "ROOT"; $PASSWD = ""; $database = "cssonlinedb";
$connect_db = mysql_connect("$host","$user","$passwd"); if (!$connect_db) { die ('Could not Connect: ' . mysql_error() ); } mysql_select_db("$database", $connect_db) or die ('Cant connect the database: ' . mysql_error() ); $id = $_POST['stud_id']; $passwd = $_POST['password']; $lname = $_POST['last_name']; $fname = $_POST['first_name']; $mname = $_POST['middle_name']; $mail = $_POST['email']; $gender = $_POST['gender']; $yrlevel = $_POST['level']; $country = $_POST['country']; //error line $sql = INSERT INTO registration ( stud_id, password, last_name, first_name, middle_name, email_ad, gender, year_level, country ) VALUES ( '$id', '$passwd', '$lname', '$fname', '$mname', '$mail', '$gender', '$yrlevel', '$country' ); $test = mysql_query($sql); if (!$test) { die ('Error: ' . mysql_error() ); } mysql_close(); ?> please because this is my thesis proposal, and i cant deal with it!!!!!!!!
You have no qoutes around the variable value.
Code: [Select]$sql = "INSERT INTO registration ( stud_id, password, last_name, first_name, middle_name, email_ad, gender, year_level, country ) VALUES ( '$id', '$passwd', '$lname', '$fname', '$mname', '$mail', '$gender', '$yrlevel', '$country' )"; thanks.,., it works now!!!Great!
|