PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi all,:)
I am getting error when trying to run this code!!
The code is:
Why is it giving this error--
Parse error: syntax error, unexpected $end in C:\xxx\www\test\create.php on line 182
How to rectify the error?
Please help...
Thanks in advance
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Last edited by z0 on Sat Sep 29, 2007 5:42 am, edited 1 time in total.
feyd wrote:Count the number of opening and closing braces your code has. Mostly likely, there is a mismatch.
Also, to add onto that, if you use Notepad++ (google it, it's a very good text editor), you can see your { and } braces match up when you click on them, so it makes it much easier to make sure they all match.
To expand, indenting (tabbing or spacing) your code would help you visually identify where the braces don't match up. PHP and HTML. And, it's a good practice.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
But still I am getting error-
Parse error: syntax error, unexpected $end in C:\wamp\www\test\cr1.php on line 182
What does this " unexpected $end" means??
Apart from braces mismatching, are there no other errors?I mean,is the code perfect?
function create_account()
{
$userid=$_POST['userid'];
$username=$_POST['username'];
$userpassword=$_POST['userpassword'];
$userpassword2=$_POST['userpassword2'];
$userposition=$_POST['userposition'];
$useremail=$_POST['useremail'];
$userprofile=$_POST['userprofile'];
global $default_dbname,$user_tablename;
if(empty($userid)){
error_message("Enter yur desired ID!");
}
if(empty($userpassword)){
error_message("Enter your password!");
}
if(strlen($userpassword)<4){
error_message("Password too short!");
}
if(empty($userpassword2)){
error_message("Retype your password for verification");
}
if(empty($username)){
error_message("Enter your full name:");
}
if(empty($useremail)){
error_message("Enter your email address!");
if(empty($userprofile)){
$userprofile="No comment";
}
if($userpassword!=$userpassword2){
error_message("your desired password and retyped password mismatch!");
}
$link_id=db_connect($default_dbname);
if(in_use($userid)){
error_message("userid is in use.Please choose a different ID");
$query="INSERT INTO user VALUES(NULL,'$userid',password('$userpassword')'$username','$userposition','$useremail','$userprofile')";
$result=mysql_query($query);
if($result){
error_message(sql_error());
}
$usernumber=mysql_insert_id($link_id);
html_header(sql_error());
}
Where is the brace missing in the above code?
Can you please point me the line number in the above code?
Paste your previous code in text-editor and give proper tabbing in order to check for the missing braces or closing tags. See below code related with your last function, here you have missed 2 closings..