MasterACE14 Posted July 9, 2007 Share Posted July 9, 2007 I am recieving a parse error, it says: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/ace/public_html/shadowlords/functiondebug.php on line 28 line 28: if($userrow['charname'] == "$userrow['charname'] ~SS~"){ full code: <?php function donate1() { global $userrow; if($userrow['charname'] == "$userrow['charname'] ~SS~"){ $redd = ""; } elseif($userrow['charname'] !== "$userrow['charname'] ~SS~"){ $redd = " ~SS~"; } $charn = "$userrow['charname']"; $bank = "$userrow['bank']"; $maxmp = "$userrow['maxmp']"; $maxtp = "$userrow['maxtp']"; $maxhp = "$userrow['maxhp']"; $strengthh = "$userrow['strength']"; $dexterityy = "$userrow['dexterity']"; $experiencee = "$userrow['experience']"; if ($userrow['verify'] == 1) { $charn = $userrow['charname'] . $redd; $bank = ceil($userrow['bank']+2500); $maxmp = ceil($userrow['maxmp']+25); $maxtp = ceil($userrow['maxtp']+25); $maxhp = ceil($userrow['maxhp']+25); $strengthh = ceil($userrow['strength']+25); $dexterityy = ceil($userrow['dexterity']+25); $experiencee = ceil($userrow['experience']+100); //echo("Transaction Successful!"); } elseif ($userrow['verify'] !== 1) { die("This Page is restricted to people that have verified their accounts"); } $con = mysql_connect("localhost","ace_ACE","******"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("ace_sl", $con); mysql_query("UPDATE `sl_users` SET `charname`='$charn' WHERE id='".$userrow['id']."'") or die ("MYSQL ERROR: ".mysql_error().""); mysql_query("UPDATE `sl_users` SET `bank`='$bank' WHERE id='".$userrow['id']."'") or die ("MYSQL ERROR: ".mysql_error().""); mysql_query("UPDATE `sl_users` SET `maxmp`='$maxmp' WHERE id='".$userrow['id']."'") or die ("MYSQL ERROR: ".mysql_error().""); mysql_query("UPDATE `sl_users` SET `maxtp`='$maxtp' WHERE id='".$userrow['id']."'") or die ("MYSQL ERROR: ".mysql_error().""); mysql_query("UPDATE `sl_users` SET `maxhp`='$maxhp' WHERE id='".$userrow['id']."'") or die ("MYSQL ERROR: ".mysql_error().""); mysql_query("UPDATE `sl_users` SET `strength`='$strengthh' WHERE id='".$userrow['id']."'") or die ("MYSQL ERROR: ".mysql_error().""); mysql_query("UPDATE `sl_users` SET `dexterity`='$dexterityy' WHERE id='".$userrow['id']."'") or die ("MYSQL ERROR: ".mysql_error().""); mysql_query("UPDATE `sl_users` SET `experience`='$experiencee' WHERE id='".$userrow['id']."'") or die ("MYSQL ERROR: ".mysql_error().""); mysql_query("UPDATE `sl_users` SET `authlevel`='3' WHERE id='".$userrow['id']."'") or die ("MYSQL ERROR: ".mysql_error().""); }; donate1(); ?> Link to comment https://forums.phpfreaks.com/topic/59049-solved-parse-error-unexpected-white-space-etc-etc/ Share on other sites More sharing options...
suma237 Posted July 9, 2007 Share Posted July 9, 2007 try this if($userrow['charname'] == $userrow['charname'] ~SS~){ Link to comment https://forums.phpfreaks.com/topic/59049-solved-parse-error-unexpected-white-space-etc-etc/#findComment-293105 Share on other sites More sharing options...
MasterACE14 Posted July 9, 2007 Author Share Posted July 9, 2007 that gives me this error: Parse error: syntax error, unexpected '~' in /home/ace/public_html/shadowlords/functiondebug.php on line 28 Link to comment https://forums.phpfreaks.com/topic/59049-solved-parse-error-unexpected-white-space-etc-etc/#findComment-293143 Share on other sites More sharing options...
MasterACE14 Posted July 9, 2007 Author Share Posted July 9, 2007 any other ideas? Link to comment https://forums.phpfreaks.com/topic/59049-solved-parse-error-unexpected-white-space-etc-etc/#findComment-293159 Share on other sites More sharing options...
JasonLewis Posted July 9, 2007 Share Posted July 9, 2007 here, this: if($userrow['charname'] == "{$userrow['charname']} ~SS~"){ just a question... why are you checking whether the same variable has ~SS~ on the end? or am i mistaken? Link to comment https://forums.phpfreaks.com/topic/59049-solved-parse-error-unexpected-white-space-etc-etc/#findComment-293350 Share on other sites More sharing options...
Yesideez Posted July 9, 2007 Share Posted July 9, 2007 I was wondering that myself! if($userrow['charname'] == $userrow['charname']." ~SS~"){ Link to comment https://forums.phpfreaks.com/topic/59049-solved-parse-error-unexpected-white-space-etc-etc/#findComment-293355 Share on other sites More sharing options...
MasterACE14 Posted July 10, 2007 Author Share Posted July 10, 2007 its for people who have become members, I want it to add ~SS~ to the end of their name to show their members, and i'm doing the if statement to make sure it doesn't keep adding ~SS~ everytime they become a member lol. had 1 member with 3 ~SS~ 's after his name lol. Link to comment https://forums.phpfreaks.com/topic/59049-solved-parse-error-unexpected-white-space-etc-etc/#findComment-294102 Share on other sites More sharing options...
teng84 Posted July 10, 2007 Share Posted July 10, 2007 I guess thats not the proper way to do that maybe you need to add some fields that will contain the active or non the members in non u can have 0 or 1 or y and n to save space Link to comment https://forums.phpfreaks.com/topic/59049-solved-parse-error-unexpected-white-space-etc-etc/#findComment-294104 Share on other sites More sharing options...
no_one Posted July 10, 2007 Share Posted July 10, 2007 Teng84 makes a good point. If you must use the ~SS~ though.. <?php if( substr($userrow['charname'], -4) == '~SS~' ) { } ?> Get last 4 characters of username, compare to ~SS~ .. Link to comment https://forums.phpfreaks.com/topic/59049-solved-parse-error-unexpected-white-space-etc-etc/#findComment-294105 Share on other sites More sharing options...
MasterACE14 Posted July 16, 2007 Author Share Posted July 16, 2007 Thanks for your help guys, I got it working nicely now Regards ACE Link to comment https://forums.phpfreaks.com/topic/59049-solved-parse-error-unexpected-white-space-etc-etc/#findComment-299431 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.