Jump to content

Archived

This topic is now archived and is closed to further replies.

Schlo_50

Unexpected parse code '='

Recommended Posts

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

<?php
if( $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

Share this post


Link to post
Share on other sites
Try changing the [color=red][b]£[/b][/color] at the beginning of the line for a [color=green][b]$[/b][/color] ;)

Regards
Huggie

Share this post


Link to post
Share on other sites
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..:(

Share this post


Link to post
Share on other sites
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.

Regards
Huggie

Share this post


Link to post
Share on other sites
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..

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.