somthing simple!!

A

Anonymous

Guest
anybody see a prob with this (the query!) as i get a parse error: exepected T_String...

i've been over and over it and can't see a thing!!
Code:
<?
		

		
		$connect = mysql_connect("www.freesql.org:3306","****","****");

		$db = mysql_select_db(****);

				
		$query = "INSERT INTO `petition` (`id`, `f_name`, `l_name`, `age`, `address_1`, `address_2`, `address_3`, `postcode`, `email`, `ip`, `datetime`) VALUES ('', '$_post[f_name]', '$_POST[l_name]', '$_POST[age]', '$_POST[address_1]', '$_POST['address_2]', '$_POST[address_3]', '$_POST[postcode]', '$_POST[email]', '$_SERVER['REMOTE_ADDR']', NOW( ))" ;

		mysql_query($query) or die ("<font color=\"#FF00FF\">sorry unable to connect to database".mysql_error()."</font>");
		
		echo("<font color=\"#FF00FF\">");
		echo("Your name has been entered to the petition");	
			echo("<\font>");
		
}
?>

cheers!
 
I would guess that the problem is the random } at the very end of your code. Other than that, I don't see any issues. It would be helpful, of course, if you told us the line number of the error.
 
oh sugar, that would help!!!

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/tragical/public_html/punkboii/mlmh/petition_add.php on line 10

(its the line with the INSERT INTO)

sorry about that its was late!!
 
Ah. All it took was a syntax-highlighting text editor: You've a stray single-quote at $_POST['address2]. Oh, and since you're within a double-quoted block, you can drop the single-quotes from inside $_SERVER['REMOTE_ADDR']
 
Back
Top