PDA

View Full Version : Date() Just Won't Work


tomyknoker
04-13-2007, 01:14 PM
I have this line

while ($qry = mysql_fetch_array($results)) {
// if (strtotime($qry['loginDateTime']) <= (time() + 86400*31)) {
$login .= 'Name: '.$qry["FirstName"].' '.$qry["LastName"].' ('.$qry["JoinDate"]?date("d/m/Y", strtotime($qry["JoinDate"])).') '.$qry["Email"].''.$qry["rep_NBR"].' ('.$qry["State"].')
';
//}
}

And when I run it I receive

[quoteParse error: parse error, unexpected ';' in e:\emailMembersPending.php on line 43[/quote]

I just don't get it obvioulsy I'm doing something stupid with the 'JoinDate' but I can't work it out!

nikkiH
04-13-2007, 03:50 PM
I'm not overly versed in php (still learning), but in c and javascript, etc, the question mark is a tertiary (ternary?) operator. Like an if/else but not. :)

myvar = whatever?1:2

So, I'd expect a colon in here, but I don't see one.

$qry["JoinDate"]?date("d/m/Y", strtotime($qry["JoinDate"]))

maybe

$qry["JoinDate"]?date("d/m/Y", strtotime($qry["JoinDate"])):""

or something?

NancyJ
04-13-2007, 06:16 PM
That wouldnt seem to be appropriate here - but yes that would get rid of the parse error. I think its more likely though that thje ? should be a .

Mhtml
04-13-2007, 06:46 PM
I'm not overly versed in php (still learning), but in c and javascript, etc, the question mark is a tertiary (ternary?) operator. Like an if/else but not. :)
lol, made me chuckle - yes it's ternary ;).

Don't forget your semicolons.