Schlo_50 Posted September 21, 2006 Share Posted September 21, 2006 [b]Parse error[/b]: parse error, unexpected '=' in [b]/home/www/dombar0.freehostia.com/adduser2.php [/b] on line [b]29[/b]I keep getting this message after i submit my user registration form. This is my first proper go at a script so i am a n00b to it, although i just can't figure out whats wrong.Line 29 is this: [color=blue]£conn=@mysql_connect( "localhost","databaseusername","databasepassword" )[/color]This is the main script:<?php$self=$_SERVER['PHP_SELF'];$firstname=$_POST['first_name'];$surname=$_POST['sur_name'];$username=$_POST['user_name'];$password=$_POST['password'];?><form action="http://dombar0.freehostia.com/adduser2.php" method="post">First Name: <input type="text" name="first_name"><br>Last Name: <input type="text" name="sur_name"><br>Username: <input type="text" name="user_name"><br>Password: <input type="text" name="password"><br><input type="Submit"></form><?phpif( $firstname and $surname and $username and $password ) { £conn=@mysql_connect( "localhost","databaseusername","databasepassword" ) or die( "Err:Conn" ); $rs = @mysql_select_db( "dombar0_work", $conn ) or die( "Err:Db" ); $sql="INSERT INTO users ( first_name, sur_name, user_name, password) values ( $firstname, \"surname\", \"username\", \"password\" )"; $rs = mysql_query( $sql, $conn ); if ($rs){ echo( "Records Added:$firstname $surname $username $password" ); }} ?>Also, while im here can someone tell me simply what '<form action' is and what i should type after it?Thanks for any help with either questions guys ;)Schlo_50 Quote Link to comment https://forums.phpfreaks.com/topic/21506-unexpected-parse-code/ Share on other sites More sharing options...
HuggieBear Posted September 21, 2006 Share Posted September 21, 2006 Try changing the [color=red][b]£[/b][/color] at the beginning of the line for a [color=green][b]$[/b][/color] ;)RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/21506-unexpected-parse-code/#findComment-95922 Share on other sites More sharing options...
Schlo_50 Posted September 21, 2006 Author Share Posted September 21, 2006 Thankyou, i checked everything else apart from the '$' signs. lol Now i just need to figure out why the script loaded with no errors but didn't actually add anything to my database..:( Quote Link to comment https://forums.phpfreaks.com/topic/21506-unexpected-parse-code/#findComment-95943 Share on other sites More sharing options...
HuggieBear Posted September 21, 2006 Share Posted September 21, 2006 Do you know what the @ in front of the function calls is doing?@ supresses the error messages. So if you're having issues with nothing getting into your database then I suggest you remove the @ and try again.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/21506-unexpected-parse-code/#findComment-95947 Share on other sites More sharing options...
Schlo_50 Posted September 21, 2006 Author Share Posted September 21, 2006 Is my <form action...bit ok? Im not sure what i should put there, although the URL back to the page with the form on it seems to work.. Quote Link to comment https://forums.phpfreaks.com/topic/21506-unexpected-parse-code/#findComment-96132 Share on other sites More sharing options...
Schlo_50 Posted September 21, 2006 Author Share Posted September 21, 2006 Cheers Huggie, all is working and adding to the database now. I had some spaces where there wern't meant to be so i fixed them and added the password encryption function Mysql uses. Will probably be back soon! lol Quote Link to comment https://forums.phpfreaks.com/topic/21506-unexpected-parse-code/#findComment-96146 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.