hi,
i have the following, which lists days of the week, and records associated with each of them from an MS Access table. i would like to know how to display the count of the records associated with each day instead of the separate associated records.
[code=php]
<?php
$test = array('sunday count','monday count','tuesday count','wednesd ay count','thursda y count','friday count', 'saturday count');
$day=date('w'); //Numeric representation of the day of the week 0 (for Sunday) through 6 (for Saturday)
$key=each($test );
while ($key['key']!=$day)
$key=each($test );
prev($test);
prev($test);
for ($i=0;$i<7;$i++ )
{
$count = (next($test)) ? current($test) : reset($test);
############### ############### ############### ####
#DETAIL SECTION
############### ############### ############### ####
print "details: <br>";
$conn=odbc_conn ect('TEST','',' ');
if (!$conn)
{exit("Connecti on Failed: " . $conn);}
$sql="SELECT * FROM tbl_news WHERE dayname ='".$count."' ";
$rs=odbc_exec($ conn,$sql);
if (!$rs)
{exit("Error in SQL");}
while (odbc_fetch_row ($rs))
{
$news=odbc_resu lt($rs,"infosec tion");
echo "$news";
}
############### ############### ############### ####
# END OF DETAIL SECTION
############### ############### ############### ####
echo $count.'<br />';
}
?>
[/code]
thanks in advance,
geebee
i have the following, which lists days of the week, and records associated with each of them from an MS Access table. i would like to know how to display the count of the records associated with each day instead of the separate associated records.
[code=php]
<?php
$test = array('sunday count','monday count','tuesday count','wednesd ay count','thursda y count','friday count', 'saturday count');
$day=date('w'); //Numeric representation of the day of the week 0 (for Sunday) through 6 (for Saturday)
$key=each($test );
while ($key['key']!=$day)
$key=each($test );
prev($test);
prev($test);
for ($i=0;$i<7;$i++ )
{
$count = (next($test)) ? current($test) : reset($test);
############### ############### ############### ####
#DETAIL SECTION
############### ############### ############### ####
print "details: <br>";
$conn=odbc_conn ect('TEST','',' ');
if (!$conn)
{exit("Connecti on Failed: " . $conn);}
$sql="SELECT * FROM tbl_news WHERE dayname ='".$count."' ";
$rs=odbc_exec($ conn,$sql);
if (!$rs)
{exit("Error in SQL");}
while (odbc_fetch_row ($rs))
{
$news=odbc_resu lt($rs,"infosec tion");
echo "$news";
}
############### ############### ############### ####
# END OF DETAIL SECTION
############### ############### ############### ####
echo $count.'<br />';
}
?>
[/code]
thanks in advance,
geebee
Comment