/    Sign up×
Community /Pin to ProfileBookmark

or statement troubles

I’m misssing something, probably really small, i always do. could someone please tell me what is wrong.

I’m having this error:

[code]Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ‘,’ or ‘;’ in /home/masc/www/calender.php on line 31[/code]

on the bottom line of this code sample.

[code=php]
/*line 30*/if(($x==0) or ($x==7) || ($x==14) || ($x==21) || ($x==28) || ($x==35)){echo “<tr valign=’top’>”;}
/*line 31*/if(($x==6) or ($x==13) || ($x==20) || ($x==27) || ($x==34) || ($x==41)){echo “</tr>”;}[/code]

what I’m trying to do is make a table through a for statement and i’m having troubles with this or statement that puts an end table row tag at certain intervals in this table. here’s the full for statement for reference.

[code=php]for($x=0; $x==$mdays; $x++){
if(($x==0) or ($x==7) || ($x==14) || ($x==21) || ($x==28) || ($x==35)){echo “<tr valign=’top’>”;}
if(($x==6) or ($x==13) || ($x==20) || ($x==27) || ($x==34) || ($x==41)){echo “</tr>”;}
if($x>=$fd){
echo “<td class=’cell’ background=’tabletemplatesmall.gif’><span class=’date’>”.$x+1.”&nbsp;&nbsp;</span>”;
echo “<a href=”></a></td>”;}
else{
echo “<td class=’cell’><img src=’tabletemplatesmall.gif’></td>”;}
}[/code]

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@balloonbuffoonMar 28.2006 — Hmm...I tested your lines 30 and 31 and got no error. I wonder what could be triggering the error...

--Steve
Copy linkTweet thisAlerts:
@sacx13Mar 29.2006 — what version of php do you use ?

try to replace or with || because is the same thing

Regards

Adrian
Copy linkTweet thisAlerts:
@bathurst_guyMar 29.2006 — *removed as I found out I was wrong*
Copy linkTweet thisAlerts:
@PhalonauthorMar 29.2006 — what version of php do you use ?

-sacx13[/QUOTE]


PHP Version 4.3.9

Well if i can't get this to work ill just build the table then use arrays to fill it, there's always to get these things to work.
Copy linkTweet thisAlerts:
@NogDogMar 29.2006 — <i>
</i>echo "&lt;td class='cell' background='tabletemplatesmall.gif'&gt;&lt;span class='date'&gt;".
[color=red]([/color]$x+1[color=red])[/color]."&amp;nbsp;&amp;nbsp;&lt;/span&gt;";

(I think it's an operator precedence thing that was causing the problem.)
Copy linkTweet thisAlerts:
@PhalonauthorMar 30.2006 — thanks that cleared up the error, but i still need to work on it because it's just not printing out the table as i would like. oh well, that's life.
×

Success!

Help @Phalon spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...