Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
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
Posted on 05-21-04 01:09 AM Link | Quote
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]{
$wbon=mysql_fetch_array(mysql_query("SELECT spr,hp FROM store_weapon WHERE name='".$poster[weapon]."'"));
}else{$wbon=0;}


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'");
while($poster = mysql_fetch_array($select)){
$lv=$loguser[powerlevel]+1;
if($poster[weapon]{
$wbon=mysql_fetch_array(mysql_query("SELECT spr,hp FROM store_weapon WHERE name='".$poster[weapon]."'"));
}else{$wbon=0;}
if($poster[armor]){
$abon=mysql_fetch_array(mysql_query("SELECT hp FROM store_armor WHERE name='".$poster[armor]."'"));
}else{$abon=0;}
if($poster[relic]){
$rbon=mysql_fetch_array(mysql_query("SELECT spr,hp FROM store_relic WHERE name='".$poster[relic]."'"));
}else{$rbon=0;}
$spr=floor($poster[posts]/8)*$lv;
$spr=$spr+$wbon[spr]+$rbon[spr];
$maxhp=floor($spr/4)*$lv;
$maxhp=$maxhp+$wbon[hp]+$abon[hp]+$rbon[hp];
}
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
Posted on 05-21-04 01:34 AM Link | Quote
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
Posted on 05-21-04 01:38 AM Link | Quote
...

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
Posted on 05-21-04 02:41 AM Link | Quote
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
Posted on 05-21-04 03:12 AM Link | Quote
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
Posted on 05-21-04 06:52 AM Link | Quote
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:
  • what exactly is the error? (usually, it expects X but gets Y)
  • where did it occur? (often, the source of an error is before the line in question, but it'd still help to know where it occured)
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
Posted on 05-21-04 07:04 AM Link | Quote
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
Posted on 05-21-04 11:33 AM Link | Quote
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
Posted on 05-22-04 03:49 AM Link | Quote
Originally posted by ErkDog
so ['string'] specifies "string" field in the array whereas [string] just ends up working cause it matches the field in the array ?


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 &amp; 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 | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.009 seconds.