| | |
Unexpected T_STRING
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2006
Posts: 20
Reputation:
Solved Threads: 0
This is my code but I get the error
Parse error: parse error, unexpected T_STRING in /home/projecte/public_html/index.php on line 48
When I try it, any ideas on whats gone wrong
Parse error: parse error, unexpected T_STRING in /home/projecte/public_html/index.php on line 48
When I try it, any ideas on whats gone wrong
PHP Syntax (Toggle Plain Text)
<?PHP switch ($pg) { case login: $dbh=mysql_connect ("localhost", "projecte_ries", "*********") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("projecte_gamedb"); $_POST['email'] == $email; $_POST['password'] == $pass; if (!isset($_POST['email'])) { $error == 1; die('<center><body bgcolor=black>No email address was entered into the email field</body></center>'); } if (!isset($_POST['password'])) { $error == 1; die('<center>You did not input a password in the password field</body></center>'); } $checklog = mysql_query("SELECT user,pass FROM members WHERE `email`='$email'")or die(mysql_error()); while($checked = mysql_fetch_array($checklog)) { if ($checked['password'] != $pass) { $error = 1; die('<center>You entered a incorrect password :o</center>'); }else{ echo "<meta http-equiv='Refresh' content='0;url=members.php'>"; } } break; case register: echo "<html> <head> <title>Red Winter</title> </head> <body><center><table width='600' height='200'><tr><td></tr></td></table>"; echo "<form action='index.php?pg=register2'>email:<input type='text' name='email' /><br /> pass:<input type='password' name='password' /><br /> username:<input type='text' name='user' />"; echo "<br /><input type='submit' value='Register' /></form>"; break; case register2: echo "<html> <head> <title>Red Winter</title> </head> <body><center><table width='600' height='200'><tr><td></tr></td></table>"; $_POST['email'] == $email; $_POST['pass'] == $pass; $_POST['user'] == $user; $reg = mysql_query("SELECT * FROM members WHERE `email`='$email' ")or die(mysql_error()); @$numm = mysql_num_rows($reg); if ($numm == "1"){ die('Someone already has an account with that email, you can't have multis'); } $sign = mysql_query("SELECT * FROM members WHERE `user`='$user' ")or die(mysql_error()); @$sigg = mysql_num_rows($sign); if ($sigg == "1"){ die('That username is already in use, go back and try another.'); } $add = mysql_query("INSERT INTO members ('user','pass','email') VALUES ('$user','$pass','$email') ")or die(mysql_error()); echo "You can now login and play :D<br />"; break; default: $dbh=mysql_connect ("localhost", "projecte_ries", "********") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("projecte_gamedb"); $sigings = mysql_query("SELECT * FROM members")or die(mysql_error()); @$signed = mysql_num_rows($sigings); echo "<html> <head> <title>Red Winter</title> </head> <body><center><table width='600' height='200'><tr><td></tr></td></table> "; echo " <style type='text/css'> input, textarea, select { color: white; background: #000000; border: solid white 1px; } a { text-decoration: none; text-transform: none; color: white; font-family: verdana; font-size: 10px; } body { background: #000000; background-attachment: fixed; background-possition: center; font-family: verdana; color: white; font-size: 10px; } </style> $signed people are already playing!<br /> <form action='index.php?pg=login' method='post'> email:<input type='text' name='email' /><br /> pass: <input type='password' name='password' /><br /> <input type='submit' value='Login' /><br /><br /><br /> <a href='index.php?pg=login'>Login</a> : <a href='index.php?pg=register'>Register</a> : <a href='index.php?pg=tos'>ToS</a>"; break; } ?>
on this section of code
your error message has a ' in it
so change it to or
PHP Syntax (Toggle Plain Text)
@$numm = mysql_num_rows($reg); if ($numm == "1"){ die('Someone already has an account with that email, you can't have multis'); }
so change it to
PHP Syntax (Toggle Plain Text)
die("Someone already has an account with that email, you can't have multis");
PHP Syntax (Toggle Plain Text)
die('Someone already has an account with that email, you can\'t have multis');
•
•
Join Date: Apr 2006
Posts: 4
Reputation:
Solved Threads: 0
look on this line
you need to change it like
see the diffrence of comma,
you have to hide that in your code by "\"
•
•
•
•
if ($numm == "1"){
die('Someone already has an account with that email, you can't have multis');
}
•
•
•
•
if ($numm == "1"){
die('Someone already has an account with that email, you can\'t have multis');
}
you have to hide that in your code by "\"
Ravish Kumar
I run Loanskey ( A Loan and Mortgage infomation company) and RealEstateCut ( A real estate listing websites ) . I love both of these websites. and this is a subdomain of the loanskey for UK
I run Loanskey ( A Loan and Mortgage infomation company) and RealEstateCut ( A real estate listing websites ) . I love both of these websites. and this is a subdomain of the loanskey for UK
![]() |
Similar Threads
- unexpected T_STRING (PHP)
- Please Help! parse error, unexpected T_STRING (PHP)
- Parse error: parse error, unexpected T_STRING (PHP)
- Unexpected T_STRING? (PHP)
- Unexpected T_String: I'm not seeing it (PHP)
- PHP Parse error: parse error, unexpected T_STRING (PHP)
- Parse error: parse error, unexpected T_STRING in /home/thei2k9/public_html/includes/f (PHP)
Other Threads in the PHP Forum
- Previous Thread: proj stuff
- Next Thread: Need Freelancing Partner
| Thread Tools | Search this Thread |
.htaccess alerts apache api archive array autocomplete beginner binary broken cakephp checkbox class cms code convert cron curl database dataentry date display duplicates dynamic echo email emptydisplayvalue error execute explodefunction file files firstoptioninphpdroplist folder form forms function functions google hack href htaccess html htmlspecialchars image include insert ip javasciptvalidation javascript joomla keywords limit link login mail matching menu methods mlm multiple mysql network object oop paypal pdf php problem query radio random recursion recursive redirect remote script search securephp server sessions shot sms source space sql subscription syntax system table tutorial tutorials update upload url validator variable video web youtube





