Jump to content

Logic help, please?


Moron

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?
Link to comment
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]
Link to comment
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).
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.