R1der Posted November 2, 2006 Share Posted November 2, 2006 ok i tried my best to fix this my self and then found my self here asked for help loli get this errorParse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/lostcity/public_html/mailbomb.php on line 41[code]<?PHP $rand = rand(11,20); if($rand==11 || $rand==12 || $rand==13 || $rand==14 || $rand==15 || $rand==16 || $rand==17 || $rand==18 || $rand==19 || $rand==20){ echo "You Go and buy a bomb and some anthrax You send it to $r['username'] through the maill thay open the package and the bomb explodes spraying anthrax in there face and landing them in hospital for 400 minutes and earning you 650 exp."; // this is line 41 mysql_query("update users set exp=exp+650 , money=money-15000 where userid=$userid",$c); mysql_query("UPDATE users SET hospreason=\"Sprayed with anthrax from $ir['username'] WHERE userid={$in}", $c); event_add($in, "<a href='viewuser.php?u=$userid'>{$ir['username']}</a> Sent you a mailbomb in the mail spraying anthrax in your face you are in hospital!", $c);}?>[/code][code]echo "You Go and buy a bomb and some anthrax You send it to $r['username'] through the maill thay open the package and the bomb explodes spraying anthrax in there face and landing them in hospital for 400 minutes and earning you 650 exp."; // this is line 41[/code]can anyone spot the problem?thanks for your time Quote Link to comment https://forums.phpfreaks.com/topic/25934-error-on-my-page/ Share on other sites More sharing options...
trq Posted November 2, 2006 Share Posted November 2, 2006 Not sure what the error is (might need to see some code before what youve posted) but your if could be shortened.[code=php:0]if ($rand > 10 && $rand < 21) { // blah blah}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/25934-error-on-my-page/#findComment-118433 Share on other sites More sharing options...
R1der Posted November 2, 2006 Author Share Posted November 2, 2006 This is more of the code[code=php:0]<?PHP$rand = rand(1,10); if($rand==1 || $rand==2 || $rand==3 || $rand==4 || $rand==5 || $rand==6 || $rand==7 || $rand==8 || $rand==9 || $rand==10){ echo "You cross the wires in the bomb as you are putting it together it explodes and sprays anthrax in your face and landing you in hospital for 400 minutes and taking 300 exp from you."; mysql_query("update users set exp=exp-300 , hospital=hospital+400 , hospreason=\"Sprayed with anthrax while doing a mailbomb\" where userid=$userid",$c);}$rand = rand(11,20); if($rand==11 || $rand==12 || $rand==13 || $rand==14 || $rand==15 || $rand==16 || $rand==17 || $rand==18 || $rand==19 || $rand==20){ echo "You Go and buy a bomb and some anthrax You send it to $r['username'] through the maill thay open the package and the bomb explodes spraying anthrax in there face and landing them in hospital for 400 minutes and earning you 650 exp."; mysql_query("update users set exp=exp+650 , money=money-15000 where userid=$userid",$c); mysql_query("UPDATE users SET hospreason=\"Sprayed with anthrax from $ir['username'] WHERE userid={$in}", $c); event_add($in, "<a href='viewuser.php?u=$userid'>{$ir['username']}</a> Sent you a mailbomb in the mail spraying anthrax in your face you are in hospital!", $c);}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/25934-error-on-my-page/#findComment-118437 Share on other sites More sharing options...
trq Posted November 2, 2006 Share Posted November 2, 2006 Second look and your code makes no sense. You generate a random number between 1 - 10, then execute some code if your random number is between 1 - 10. Whats the point?Also... do you like typing or something? See my previous reply.As for your error. I dont see anything in your code that would generate that error. Quote Link to comment https://forums.phpfreaks.com/topic/25934-error-on-my-page/#findComment-118439 Share on other sites More sharing options...
R1der Posted November 2, 2006 Author Share Posted November 2, 2006 yes 1 - 10 is the fail message11 - 20 is the succsed messageand i dont see no point in changing the "if" statemts till i fix this error Quote Link to comment https://forums.phpfreaks.com/topic/25934-error-on-my-page/#findComment-118441 Share on other sites More sharing options...
trq Posted November 2, 2006 Share Posted November 2, 2006 [quote]yes 1 - 10 is the fail message11 - 20 is the succsed message[/quote]Both of these are going to run, one after the other.[quote]i dont see no point in changing the "if" statemts till i fix this error[/quote]Thats caused your error Im sure. You'd need to use something like...[code=php:0]if (($rand==1) || ($rand==2) || ($rand==3)) {[/code]I dont fancy typing out all the rest but you get the idea. Quote Link to comment https://forums.phpfreaks.com/topic/25934-error-on-my-page/#findComment-118446 Share on other sites More sharing options...
R1der Posted November 2, 2006 Author Share Posted November 2, 2006 HmmHow can i fix that then?Not that it really matters i am still stuck with this error lol Quote Link to comment https://forums.phpfreaks.com/topic/25934-error-on-my-page/#findComment-118452 Share on other sites More sharing options...
trq Posted November 2, 2006 Share Posted November 2, 2006 Your logic needs to look more like...[code=php:0]$rand = rand(1,20);if ($rand < 11) { // failed} else { // success}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/25934-error-on-my-page/#findComment-118456 Share on other sites More sharing options...
R1der Posted November 2, 2006 Author Share Posted November 2, 2006 thx for that.ok i have found out this is what is causing the error$r['username']can you understand why? Quote Link to comment https://forums.phpfreaks.com/topic/25934-error-on-my-page/#findComment-118480 Share on other sites More sharing options...
trq Posted November 2, 2006 Share Posted November 2, 2006 Didn't even see that. Surround it with {}. eg;{$r['username']} Quote Link to comment https://forums.phpfreaks.com/topic/25934-error-on-my-page/#findComment-118482 Share on other sites More sharing options...
R1der Posted November 2, 2006 Author Share Posted November 2, 2006 that worked great thanks for all your help Quote Link to comment https://forums.phpfreaks.com/topic/25934-error-on-my-page/#findComment-118497 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.