...

View Full Version : error in code



sirborder
02-21-2007, 11:03 PM
Ok,
I have a form that lets people sign up for my services, then it gets inserted into a MYSQL database. The person fills out the form thens submits, but there is an error on the form action page. On line 50
Here is the code.



<?
$user="databaseuser";
$password="databasepass";
$database="databasename";
$host="localhost";

$first=$_POST['firstname'];
$last=$_POST['lastname'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$mobile=$_POST['mobile'];
$address=$_POST['address'];
$city=$_POST['city'];
$state=$_POST['state'];
$zip=$_POST['zip'];

mysql_connect($host,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");

$query= "INSERT INTO contacts VALUES('','$first','$last','$email','$phone','$mobile','$address','$city','$state','$zip')";
mysql_query($query);

echo("Thank you for signing up. You will recieve an email when your submision is reviewed.")

mysql_close() <---line 50
?>

the form is at http://www.surfacehawaii.com/kylecaleb/packages/signup.php

GJay
02-21-2007, 11:04 PM
you're missing a ; on the previous line.

In future, including the error message will help people help you...

JohnDubya
02-21-2007, 11:13 PM
Not only that, you need a ; after mysql_close() as well.

sirborder
02-21-2007, 11:25 PM
thanks lol

GJay
02-21-2007, 11:32 PM
Not only that, you need a ; after mysql_close() as well.

I'll be honest and say I did miss that one, but the last line of code doesn't actually need a ; for things to work. I wouldn't reccomend doing it intentionally though, it's likely to lead to headaches should you come back and add more lines

sirborder
02-21-2007, 11:51 PM
new problem
now it is: Parse error: parse error, unexpected T_STRING in /homepages/0/d176381271/htdocs/kylecaleb/packages/insert.php on line 43

Line 43 is
mysql_connect($host,$user,$password);

I am getting confused



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum