Jump to content

Archived

This topic is now archived and is closed to further replies.

Moron

Logic help, please?

Recommended Posts

[quote]
$combodate = "$RESULT[LYR]$RESULT[Lmo]$RESULT[Lda]";
[b]//combine year, month, date into a string.[/b]

$combodatecode = strtotime($combodate);
[b]//convert to UNIX timestamp.[/b]

$lastjuly1 = date($last,0701);
[b]//"$last" is the last year in which July 1 existed. I didn't include it here.[/b]

$lastjulycode = strtotime($lastjuly1);
[b]//convert to timestamp.[/b]

echo "<td>";
echo $RESULT['Lmo'];
echo "/";
echo $RESULT['Lda'];
echo "/";
echo $RESULT['LYR'];
echo "</td>";
[/quote]

Okey-dokey. All of the above functions work because I can echo them and get a date or a timestamp, respectively. Here's the kicker.... if I echo $combodate, it seems to pull the date of a random record. If I leave it out, the above Lmo, Lda, and LYR lines pull records perfectly. It almost seems like I need to restrict records that don't exist yet until after $RESULT is called.

I tried...

[code]
if ($combodatecode >= $lastjulycode)  {

echo "<td>";
echo $RESULT['Lmo'];
echo "/";
echo $RESULT['Lda'];
echo "/";
echo $RESULT['LYR'];
echo "</td>";

}
[/code]

No go. It pulled two records when it normally (and should) pull eight.
I also tried this inside the while loop. No go.

Ideas?

Share this post


Link to post
Share on other sites
[code]$combodate = mktime(null, null, null, $RESULT['Lmo'], $RESULT['Lda'], $RESULT['LYR']);

$lastjuly1 = mktime(null, null, null, 7, 1, $RESULT['LYR'] - 1);

echo '$combodate = ' . $combodate . ' which is: ' . date("Y-m-d", $combodate) . "<br />";
echo '$lastjuly1 = ' . $lastjuly1 . ' which is: ' . date("Y-m-d", $lastjuly1);[/code]

Share this post


Link to post
Share on other sites
[quote author=hitman6003 link=topic=105970.msg423534#msg423534 date=1156795125]
[code]$combodate = mktime(null, null, null, $RESULT['Lmo'], $RESULT['Lda'], $RESULT['LYR']);

$lastjuly1 = mktime(null, null, null, 7, 1, $RESULT['LYR'] - 1);

echo '$combodate = ' . $combodate . ' which is: ' . date("Y-m-d", $combodate) . "<br />";
echo '$lastjuly1 = ' . $lastjuly1 . ' which is: ' . date("Y-m-d", $lastjuly1);[/code]
[/quote]

Thanks. This code works, but how do I incorporate it into the while satement? In other words, I only want to display records from the previous July 1 of the fiscal year ($last).

Share this post


Link to post
Share on other sites
[quote author=hitman6003 link=topic=105970.msg423554#msg423554 date=1156797547]
what format are you storing the date in your database?
[/quote]

It's Month (2-digit), Day (2-digit), and Year (4-digit).

Thanks!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.