PDA

View Full Version : Parse error in this code...


Tim Wheatley
10-18-2002, 12:59 PM
Parse error: parse error, unexpected T_LOGICAL_AND in /data/docs/racesimcentral.com/docs/forum/forumdisplay.php on line 641

if ($thread[attach]>0) and $bbuserinfo['styleid']=17) {
$paperclip="<img src=\"{imagesfolder}/paperclip.gif\" alt=\"$thread[attach] Attachment(s)\" border=\"0\" align=\"absmiddle\">";
}
} else {
$paperclip="<img src=\"{imagesfolder}/paperclip2.gif\" alt=\"$thread[attach] Attachment(s)\" border=\"0\" align=\"absmiddle\">";
}

Should the else be elsif?

Tim Wheatley
10-18-2002, 01:00 PM
Ah, should there be no closing bracket?
$thread[attach]>0)

Tim Wheatley
10-18-2002, 01:21 PM
Or should the ) above else be at the bottom of the code?

Dean C
10-18-2002, 05:27 PM
lol my bad coding... someone will know the solution to this im sure :D

- miSt

Lesane
10-18-2002, 05:53 PM
This is the basic:


if ((condition) AND (condition)) {
code here
} else {
code here
}

Know you know how to finish it ;)

Tim Wheatley
10-18-2002, 06:19 PM
I was sure this should work but it doesn't?!?

if (($thread[attach]>0) AND ($bbuserinfo['styleid']=1)) {
$paperclip="<img src=\"{imagesfolder}/papercliplite.gif\" alt=\"$thread[attach] Attachment(s)\" border=\"0\" align=\"absmiddle\">";
} elseif (($thread[attach]>0) AND ($bbuserinfo['styleid']=17)) {
$paperclip="<img src=\"{imagesfolder}/paperclipdark.gif\" alt=\"$thread[attach] Attachment(s)\" border=\"0\" align=\"absmiddle\">";
} else {
$paperclip="";
}

It shows papercliplite on both! :(

Lesane
10-18-2002, 06:34 PM
if (($thread[attach]>0) AND ($bbuserinfo['styleid']=="1")) {
$paperclip="<img src=\"{imagesfolder}/papercliplite.gif\" alt=\"$thread[attach] Attachment(s)\" border=\"0\" align=\"absmiddle\">";
} elseif (($thread[attach]>0) AND ($bbuserinfo['styleid']=="17")) {
$paperclip="<img src=\"{imagesfolder}/paperclipdark.gif\" alt=\"$thread[attach] Attachment(s)\" border=\"0\" align=\"absmiddle\">";
} else {
$paperclip="";
}

Tim Wheatley
10-18-2002, 06:40 PM
Damn, I was SO close! ;)

Thanks very much. :D

Tim Wheatley
10-18-2002, 06:44 PM
Yes, this works - thanks. :D