zeeshan Posted March 12, 2008 Share Posted March 12, 2008 i dont know whats the problem because iam unable to see whats the problem here <?phpfunction showheader ($title) {?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML><HEAD><TITLE> Pokemon Meteor </TITLE></HEAD><BODY BGCOLOR="#FFFFFF"><CENTER><?php}?>mysql_connect("localhost", "pokemonmeteor_zxq_net_x", "computer");mysql_select_db("pokemonmeteor_zxq_net_x");if ($Password == $confirm_password) { $user = mysql_query("SELECT * FROM info (Username='$username')"); if (mysql_num_rows($Username) > 0) { { echo "User Name Taken !"; } ?> <p>We are sorry to inform you that the User Name <B><?php echo $Name ?></B> Is already Taken.</p> <?php } else { $user = mysql_query("INSERT INTO info VALUES ('$Username','$Password','$confirm_password','$Email','$Confirm_email','$Trainer's_title)"); setcookie("pokemonmeteor_zxq_net_x", $user, time() + 3600, "/"); setcookie("computer", $Password, time() +3600, "/"); showheader("Registration Success!"); ?> You have registered.<BR> Username: <?php echo $Username ?> <BR> Password: <?php echo $Password ?> <?php } }else { showheader("Registration Error!"); ?> Your Confirm Password Did Not Match <?php showfooter();}?>?> the error message show in the browser was Parse error: syntax error, unexpected '}' in /www/zxq.net/p/o/k/pokemonmeteor/htdocs/insert.php on line 30i dont know where the error was Link to comment Share on other sites More sharing options...
Peppe L-G Posted March 12, 2008 Share Posted March 12, 2008 According to the message, it complains over a '}' that shouldn't be where it is, and when you get that message you usually don't have the same number of { as }.In this case you have two { after an if. Link to comment Share on other sites More sharing options...
zeeshan Posted March 12, 2008 Author Share Posted March 12, 2008 i dont get u can u show me where i have the exact problem Link to comment Share on other sites More sharing options...
Peppe L-G Posted March 12, 2008 Share Posted March 12, 2008 You have 5 '{' and 4 '}'. One of the '{' shouldn't be in the code.Do you not see where it is a '{' that shouldn't be there?Maybe it's a bit hard to find, but if you would make your code look nice with tabs or spaces in a good way, you would see the wrong one direct. Right now it's a bit hard to see which code that lies in which if-statement. Link to comment Share on other sites More sharing options...
justsomeguy Posted March 12, 2008 Share Posted March 12, 2008 This is the same code, reformatted: <?phpfunction showheader ($title) { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <TITLE> Pokemon Meteor </TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF"> <CENTER> <?php}?>mysql_connect("localhost", "pokemonmeteor_zxq_net_x", "computer");mysql_select_db("pokemonmeteor_zxq_net_x");if ($Password == $confirm_password) { $user = mysql_query("SELECT * FROM info (Username='$username')"); if (mysql_num_rows($Username) > 0) { { echo "User Name Taken !"; } ?> <p>We are sorry to inform you that the User Name <B><?php echo $Name ?></B> Is already Taken.</p> <?php } else { $user = mysql_query("INSERT INTO info VALUES('$Username','$Password','$confirm_password','$Email','$Confirm_email','$Trainer's_title)"); setcookie("pokemonmeteor_zxq_net_x", $user, time() + 3600, "/"); setcookie("computer", $Password, time() +3600, "/"); showheader("Registration Success!"); ?> You have registered.<BR> Username: <?php echo $Username ?> <BR> Password: <?php echo $Password ?> <?php }}else{ showheader("Registration Error!"); ?> Your Confirm Password Did Not Match <?php showfooter();}?>?> There are several problems here, again. I'm going to reference things by line number so if you don't have a text editor that shows line numbers then download something like ConTEXT. On line 13 you have a closing PHP tag, and right after that more PHP code. That's one problem, it thinks everything from line 13 to line 28 is HTML output. On lines 22 and 23 you have duplicate open brackets. That's not correct, you should only have one there. On line 20 you save the query result into a variable called $user, then on the next line you're trying to check $Username. On line 27 you're trying to print $Name. Also in the if statement on line 18 you're trying to compare 2 variables that don't exist (none of the variables in this script that you're trying to use look like they exist, you aren't getting anything from $_POST). On line 34 you're trying to use a variable called "$Trainer's_title", you are not allowed to use punctuation inside variable names, and I don't think any of the other variables in that query exist. On line 36 you're trying to set a cookie with the value inside $user, but on line 33 you made $user a MySQL resource, it doesn't hold the username. On line 54 you're trying to call a function called showfooter that doesn't exist, and on the last two lines you have duplicate closing tags. Link to comment Share on other sites More sharing options...
zeeshan Posted March 12, 2008 Author Share Posted March 12, 2008 ok ni ce can u edit it totally Link to comment Share on other sites More sharing options...
justsomeguy Posted March 12, 2008 Share Posted March 12, 2008 No I can't, there is information missing where I don't know what it is supposed to be. I'm not sure where all of the variables are coming from (I would assume from POST), or what their original names are, and I don't know what the showfooter function is supposed to be. Link to comment Share on other sites More sharing options...
zeeshan Posted March 13, 2008 Author Share Posted March 13, 2008 ok Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.