<?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?

Recommended Answers

All 4 Replies

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

lol, don't forget to terminate all statements with semicolon :D

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

best of luck super duper :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.