0
<?php
 include('dbconnect.php');
 Print "Database was found and connection was successfull!"

 $fname = $_POST['fname']; 
 $lname = $_POST['lname']; 
 $address = $_POST['address'];
 $city = $_POST['city'];
 $state = $_POST['state'];
 $zip = $_POST['zipcode'];
 
 $sql = "INSERT INTO `demoform` VALUES ('$fname', '$lname', '$address', '$city', '$state', '$zip')"; 
 if(!mysql_query($sql)){
	die('Error: ' . mysql_error());
 }
 Print "Your information has been successfully added to the database."; 
 
 ?>

For some reason, my insert is not working. I keep getting this "Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\insert.php on line 5" error message.
I checked my code for any missing ({[; etc. Am I missing anything here?

3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by baig772
0

it was a mistake on my part :D.
I was missing ' ; ' at that 3rd line. Sorry.

0

yea, lol
I'm new to this PHP + MYSQL stuff. Started learning 2-3 days ago. Really interesting so far.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.