Dears,
Here is my question:
I am write a project manage system.
Now I need to echo one week’s data and send to html show.
Any one got a good idea or codes?
My code has some issues about the loop function. Could you help me check or
give me some suggestion?
The show item like this:
This week is 25.th week of 2008
[Last Week]06/09--06/15// can be link and show the different week’s data
[This Week]06/16--06/22
[Next Week]06/23--06/29
Found 2 records in 23’Th week.
===
NAME\DAY 06/09 Monday06/10 Tuesday 06/11 Wednesday 06/12
Thursday 06/13 Friday 06/14 Saturday 06/15 Sunday
Cathy00 08361-sb 02
03 04 05
06
James 10 08362-sb 12
13 08362-sb15 16
Connie 20 21 08740-sa
23 24 25
26
Ken 30 31 08741-sb
33 34 08741-sb
36
My code here (But it seems that some issues on show)
?php
//==Link to the
database==
$link = mysql_connect('localhost', 'evel', '00')//link the database
or die('Could not connect: ' . mysql_error());
mysql_select_db('evel') or die('Could not select database');
//==show the week
information===
$weeknumber=date(W);
$yearnumber=date(Y);
$tt=week_limits($weeknumber,$yearnumber);
$begin=date(m/d l,1212973261);
$end=date(m/d l, 1213491661);
echo This week is $weeknumber th week of $yearnumberbr;
echo Date from $begin($tt[0]) to $end($tt[1])br;
//===
//==show the weekdate
table==
$lowEnd=date(w);
$lowEnd=-$lowEnd;
$highEnd=$lowEnd +7;
$weekday=0;
$weektr.= link href=\require/style.css\ rel=\stylesheet\
type=\text/css\\n;
$weektr.= table width=\118\ bgcolor=\#FF\ align=center\n;
$weektr.= tr\n;
$weektr.= TD class=\Content\FONT
COLOR=BLUEBNAME\DAY/B/FONT/TD;
for ($i=$lowEnd+1;$i=$highEnd;$i++)
{
$WeekDate[$weekday]=date(m/d l,mktime(0, 0, 0, date(m) ,
date(d)+$i, date(Y)));
$datename[$weekday]=date(N,mktime(0, 0, 0, date(m) , date(d)+$i,
date(Y)));
$weektr.= TD nowrap align=center bgcolor=\F1F1F1\;
$weektr.= $WeekDate[$weekday];
$weektr.= /TD\n;
}
//===end of
weekdate
//=show the data
$result = mysql_query(select PNB,Name,Time from report where
Time='1212138371' AND Time='1212886861');//weelresult one week time area test
$num=mysql_num_rows($result);
// echo $num;//show the record number,control the table
if($num)
{
echo Found $num recordsbr;
$weektr.= tr\n;
// while($myrow=mysql_fetch_array($result,MYSQL_NUM))
// {
// $weekdaynumber=date(N,$myrow[2]);
for($x = 0;$x $num;$x++)//create the data array,for the search resule
number
{
$weekdaynumber=date(N,$myrow[2]);
for($y = 0;$y 7;$y++)//loop for tr
{
for($i=0;$i8;$i++)
{
if($weekdaynumber==$y)//get the relate week date data
{
$data[$x][$y] =$myrow[0];
}
else
$data[$x][$y] =$x$y;
}
$mat[$x][$y] = $x,$y;
}
}
//echo $weekdaynumber;
while ($x= mysql_fetch_row($result))//one by one show the data record
{ $x=0;
// for($x = 0;$x = mysql_fetch_row($result);$x++){
// for($x = 0;$x count($data[$x]);$x++)//output the data,as the
dataarray number is
// {
for($y = 0;$y 7;$y++)
{
if($y==0)//devide the cell to name and the week date and
project cell
{
$weektr.=td align=\center\$myrow[1]/td;
$weektr.=td align=\center\.$data[$x][$y]./td;
}
else