Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Acmlmboard support?. |
Acmlm's Board - I2 Archive - Acmlmboard support? - #&*($^ Parse Error | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
Elric Chasupa Currently Playing: You Like A Lute. Level: 40 Posts: 150/687 EXP: 440016 For next: 1293 Since: 03-15-04 From: Melniboné Since last post: 6 hours Last activity: 6 hours |
| ||
ARRRRRRRRRRRRRRRRRGGGGGGGG!!!!! I SWEAR, my server HATES to do a mysql_fetch_array(mysql_query) command. EVERY time I try to code something with that, it tells me there's a friggin' parse error, which, as far as I can tell, there ISN'T one. Here's the code I added to newthread.php and newreply.php: if($poster[weapon]{ Specifically, it says there's a parse error on line 115, which is the 2nd line of code posted above. And, for reference, here's the entire section of new code: $select = mysql_query("SELECT powerlevel,posts,weapon,armor,relic,hp FROM users WHERE id = '$loguserid'"); |
|||
Cymoro PATRICK DUFFY WILL LASER YOUR SOUL Level: 67 Posts: 496/2216 EXP: 2549743 For next: 43129 Since: 03-15-04 From: Cymoro Gaming Since last post: 6 hours Last activity: 4 hours |
| ||
You don't have a closing parenthesis on if($poster[weapon] { I make mistakes like that too |
|||
Elric Chasupa Currently Playing: You Like A Lute. Level: 40 Posts: 152/687 EXP: 440016 For next: 1293 Since: 03-15-04 From: Melniboné Since last post: 6 hours Last activity: 6 hours |
| ||
... Excuse me... *Elric walks off-screen, and a gun shot is heard, followed shortly by a heavy thump. Elric then returns* OK, now that I've shot myself, thank-you. I have NO idea how that happened, since I copy-pasted it from a different file, and the source file is fine. (I just checked) More proof that PHP hates me. Thanks again. |
|||
ErkDog Fuzz Ball Level: 47 Posts: 524/982 EXP: 752190 For next: 14013 Since: 03-15-04 From: Richmond, VA Since last post: 40 days Last activity: 19 days |
| ||
yeah I hate when I do that,.... cause it takes -forever- to figure out wtf is going on..... cause everything appears to be fine happens alot when you have ) ] } in the same places I've started putting a space between all ) ] } es... |
|||
SyntaxLegend Double metal axe Level: 25 Posts: 21/222 EXP: 78264 For next: 11356 Since: 04-21-04 From: Australia Since last post: 20 days Last activity: 10 hours |
| ||
i hate it when you dont close loops properly, you wanted something like the 10 latest users. and you forget to close it, the next one is 10 times as well. so you get about 200 of the samething afterwards. I get annoyed with all the ( { [ | |||
Vystrix Nexoth Level: 30 Posts: 144/348 EXP: 158678 For next: 7191 Since: 03-15-04 From: somewhere between anima and animus Since last post: 3 days Last activity: 2 days |
| ||
strictly speaking, you ought to use $poster['weapon'] instead of $poster[weapon] - the latter works but for the wrong reasons (it looks for a constant named "weapon", finds no such constant, and assumes you meant the string "weapon")it might help if you look at the parse error and see:
|
|||
ErkDog Fuzz Ball Level: 47 Posts: 531/982 EXP: 752190 For next: 14013 Since: 03-15-04 From: Richmond, VA Since last post: 40 days Last activity: 19 days |
| ||
so ['string'] specifies "string" field in the array whereas [string] just ends up working cause it matches the field in the array ? | |||
Weasel Missionary in Peru Level: 34 Posts: 341/454 EXP: 236444 For next: 17207 Since: 03-15-04 From: Washington Since last post: 467 days Last activity: 339 days |
| ||
Also, it might help if you format your code better, something that acmlmboards are notoriously bad at if($poster[weapon]){ $wbon=mysql_fetch_array(mysql_query("SELECT spr,hp FROM store_weapon WHERE name=' ".$poster[weapon]."'")); }else{$wbon=0;} change that into if( $poster['weapon'] ) { $wbon = mysql_fetch_array( mysql_query( "SELECT spr, hp FROM store_weapon WHERE name = '".$poster['weapon']."'" ) ); } else { $wbon = 0; } It lets you spot errors much easier |
|||
Vystrix Nexoth Level: 30 Posts: 147/348 EXP: 158678 For next: 7191 Since: 03-15-04 From: somewhere between anima and animus Since last post: 3 days Last activity: 2 days |
| ||
Originally posted by ErkDog not quite. in $foo[bar] , first, PHP thinks you're using a constant (defined using define()) named bar instead of the string "bar". since there is (presumably) no such constant, PHP assumes you meant the literal string "bar". if you turn error reporting up to the maximum, you'll get a warning to that effect (but it's suppressed at the default error reporting level).it works for the same reason you can slap a <title> at the very beginning of an HTML document and it'll work, or using <a href=foo.php?foo=bar&foo=bar> and it'll work in spite of not encoding the & to & like you're supposed to, and so on: it's invalid, but the browser tries to wring as much sense out of it as it can. it works... for the wrong reasons. |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Acmlmboard support? - #&*($^ Parse Error | | | |