blink359 Posted April 26, 2009 Share Posted April 26, 2009 The error is: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/nathan/unstuck.php on line 16 from my form: <?php include("config.php"); mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname); $user = $_POST['user']; $pass = $_POST['pass']; $character = $_POST['character']; { if(!$user || !$pass || !$character) { $problemMessage = "Please fill in all required fields"; $success = false; } if($success); { $result = mysql_query "SELECT acct FROM accounts WHERE login = '".$account."' AND password = '".$password."'"; or die(mysql_error()); $numrows = mysql_num_rows($result); } else { die("Account name or password is incorrect"); } $result = mysql_query "update characters SET positionX = 16237, positionY = 16396, positionZ = 60, mapId = 1, zoneId = 0, deathstate = 0 WHERE name = '".$character."'" or die(mysql_error()); echo "Character '".$character."' has been unstuck!"; mysql_close(); ?> <html> <head> <title>Auto Unstucker</title> </head> <body> <center> <form name=myform method=post action='unstucker.php'> <center><h1>Character Unstucker</h1></center> Account Name:<input type=text name=account value=''><br> Character Name:<input type=text name=character value=''><br> Password:<input type=password name=password value=''><br> <br><input type=submit name=submit value=Unstuck><br> </form> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/155732-another-form-problem/ Share on other sites More sharing options...
wildteen88 Posted April 26, 2009 Share Posted April 26, 2009 Remove the ; at the end of line 16 if($success); Quote Link to comment https://forums.phpfreaks.com/topic/155732-another-form-problem/#findComment-819706 Share on other sites More sharing options...
blink359 Posted April 26, 2009 Author Share Posted April 26, 2009 Nothing happens Quote Link to comment https://forums.phpfreaks.com/topic/155732-another-form-problem/#findComment-819707 Share on other sites More sharing options...
wildteen88 Posted April 26, 2009 Share Posted April 26, 2009 Sorry, just noticed whats going on with line 8, 7. $character = $_POST['character']; 8. { 9. if(!$user || !$pass || !$character) Have you missed something out there? If not then remove that line. Quote Link to comment https://forums.phpfreaks.com/topic/155732-another-form-problem/#findComment-819712 Share on other sites More sharing options...
blink359 Posted April 26, 2009 Author Share Posted April 26, 2009 <?php include("config.php"); mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname); $user = $_POST['user']; $pass = $_POST['pass']; $character = $_POST['character']; if(!$user || !$pass || !$character) { $problemMessage = "Please fill in all required fields"; $success = false; } if($success) { $result = mysql_query "SELECT acct FROM accounts WHERE login = '".$account."' AND password = '".$password."'" or die(mysql_error()); $numrows = mysql_num_rows($result); } else { die("Account name or password is incorrect"); } $result = mysql_query "update characters SET positionX = 16237, positionY = 16396, positionZ = 60, mapId = 1, zoneId = 0, deathstate = 0 WHERE name = '".$character."'" or die(mysql_error()); echo "Character '".$character."' has been unstuck!"; mysql_close(); ?> <html> <head> <title>Auto Unstucker</title> </head> <body> <center> <form name=myform method=post action='unstucker.php'> <center><h1>Character Unstucker</h1></center> Account Name:<input type=text name=account value=''><br> Character Name:<input type=text name=character value=''><br> Password:<input type=password name=password value=''><br> <br><input type=submit name=submit value=Unstuck><br> </form> </body> </html> still Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/nathan/unstuck.php on line 16 Quote Link to comment https://forums.phpfreaks.com/topic/155732-another-form-problem/#findComment-819719 Share on other sites More sharing options...
wildteen88 Posted April 26, 2009 Share Posted April 26, 2009 Umm, you have forgotten to wrap your query in parenthesis's when you call mysql_query on lines 16 and 25 The correct syntax for using mysql_query is $result = mysql_query('your query here'); Not $result = mysql_query 'your query here'; Quote Link to comment https://forums.phpfreaks.com/topic/155732-another-form-problem/#findComment-819722 Share on other sites More sharing options...
blink359 Posted April 26, 2009 Author Share Posted April 26, 2009 Thanks for that thats fixed that now ive got a Parse error: syntax error, unexpected T_LOGICAL_OR in /var/www/nathan/unstuck.php on line 17 Quote Link to comment https://forums.phpfreaks.com/topic/155732-another-form-problem/#findComment-819724 Share on other sites More sharing options...
wildteen88 Posted April 26, 2009 Share Posted April 26, 2009 Post lines 15 - 19 here. Quote Link to comment https://forums.phpfreaks.com/topic/155732-another-form-problem/#findComment-819727 Share on other sites More sharing options...
blink359 Posted April 26, 2009 Author Share Posted April 26, 2009 { $result = mysql_query("SELECT acct FROM accounts WHERE login = '".$account."' AND password = '".$password."'"); or die(mysql_error()); $numrows = mysql_num_rows($result); } Quote Link to comment https://forums.phpfreaks.com/topic/155732-another-form-problem/#findComment-819732 Share on other sites More sharing options...
premiso Posted April 26, 2009 Share Posted April 26, 2009 { $result = mysql_query("SELECT acct FROM accounts WHERE login = '".$account."' AND password = '".$password."'") or die(mysql_error()); $numrows = mysql_num_rows($result); } Quote Link to comment https://forums.phpfreaks.com/topic/155732-another-form-problem/#findComment-819738 Share on other sites More sharing options...
blink359 Posted April 26, 2009 Author Share Posted April 26, 2009 } $result = mysql_query("update characters SET positionX = 16237, positionY = 16396, positionZ = 60, mapId = 1, zoneId = 0, deathstate = 0 WHERE name = '".$character."'"); or die(mysql_error()); $numrows = mysql_num_rows($result); } Parse error: syntax error, unexpected T_LOGICAL_OR in /var/www/nathan/unstuck.php on line 24 Quote Link to comment https://forums.phpfreaks.com/topic/155732-another-form-problem/#findComment-819744 Share on other sites More sharing options...
wildteen88 Posted April 26, 2009 Share Posted April 26, 2009 Its the same error as last time! Remove the ; before or die Quote Link to comment https://forums.phpfreaks.com/topic/155732-another-form-problem/#findComment-819751 Share on other sites More sharing options...
premiso Posted April 26, 2009 Share Posted April 26, 2009 Do you not understand what I did to fix that issue? I mean come on now... $result = mysql_query("update characters SET positionX = 16237, positionY = 16396, positionZ = 60, mapId = 1, zoneId = 0, deathstate = 0 WHERE name = '".$character."'") or die(mysql_error()); $numrows = mysql_num_rows($result); I would hope that you are able to fix the others yourself, given that all I did was remove the semicolon before the or die statement. Quote Link to comment https://forums.phpfreaks.com/topic/155732-another-form-problem/#findComment-819754 Share on other sites More sharing options...
blink359 Posted April 26, 2009 Author Share Posted April 26, 2009 <?php $dbhost = "localhost"; $dbuser = "nathan"; $dbpass = "your_password"; $dbname = "logon"; mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname); $user = $_POST['user']; $pass = $_POST['pass']; $character = $_POST['character']; if(!$user || !$pass || !$character) { $problemMessage = "Please fill in all required fields"; $success = false; } if($success) { $result = mysql_query("SELECT acct FROM accounts WHERE login = '".$account."' AND password = '".$password."'") or die(mysql_error()); $numrows = mysql_num_rows($result); } else { die("Account name or password is incorrect"); } $result = mysql_query("update characters SET positionX = 16237, positionY = 16396, positionZ = 60, mapId = 1, zoneId = 0, deathstate = 0 WHERE name = '".$character."'") or die(mysql_error()); $numrows = mysql_num_rows($result); echo "Character '".$character."' has been unstuck!"; mysql_close(); ?> <html> <head> <title>Auto Unstucker</title> </head> <body> <center> <form name=myform method=post action='unstucker.php'> <center><h1>Character Unstucker</h1></center> Account Name:<input type=text name=account value=''><br> Character Name:<input type=text name=character value=''><br> Password:<input type=password name=password value=''><br> <br><input type=submit name=submit value=Unstuck><br> </form> </body> </html> its now just die("Account name or password is incorrect"); Quote Link to comment https://forums.phpfreaks.com/topic/155732-another-form-problem/#findComment-819758 Share on other sites More sharing options...
blink359 Posted April 26, 2009 Author Share Posted April 26, 2009 Im sorry i made it wrong i got a guy to fix hes made it more messed up than me i dont have a clue what he did Quote Link to comment https://forums.phpfreaks.com/topic/155732-another-form-problem/#findComment-819760 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.