Re: dates

From: Date: Mon, 16 Apr 2001 08:56:05 +0000
Subject: Re: dates
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-48718@lists.php.net to get a copy of this message
In article <NEBBJFBMANOMLFPKDMCAOEEGDCAA.alvintan@inscribe.com.my>, alvintan@inscribe.com.my ("Alvin Tan") wrote: > a little stuck here. trying to pull a bunch of unix timestamps out and show > only those that show up today. problem is that when i hit the first match, > the rest of the dates don't show. code follows: > > ====================== > > $sql = "SELECT * FROM dates"; > $result = mysql_query($sql) or mysql_die(); > > while ($a = mysql_fetch_array($result)) > > > $showsID = $a[showsID]; > $ts = $a[timestamp]; > $endTime=(spanDay ($ts)); // function that adds 24hrs to initial stamp to > make the end of day time. > $today = time(); > if (($endTime >= $today)&&($ts <= $today)) > { > $sq = "SELECT * FROM shows WHERE id=$showsID"; > $result = mysql_query($sq) or mysql_die(); > $b = mysql_fetch_array($result); > print "<br><font color=red>$b[name]</font><br>"; > } > } Which of the queries are you concerned with, 'cuz on that second query you're only fetching array $b once. Wrap a while() loop around it like you did with array $a if you want more rows. BTW, you're missing an opening curly brace for the first while(). -- CC

« previous php.general (#48718) next »