[PHP] question about the week's data read and show

2008-06-16 Thread EVEL_LIU
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

   

[PHP] two confuse problems

2007-08-08 Thread EVEL_LIU
Dear all

As the follow show:

I want to meet a function that,

1,Click the brows bottom, and select one file, return the file name to the text 
area and the file’s size to the $filesize.

 

I don’t how to make the browser bottom to achieve that.?

2,use the zip_read function of the PHP: (because most of the file type is *.zip 
and *.doc)

The file name will be return by a name filter function.

?php

 

$zip = zip_open(test.zip);

 

if ($zip) {

while ($zip_entry = zip_read($zip)) {

echo Name:. zip_entry_name($zip_entry) . \n;

echo Actual Filesize: . zip_entry_filesize($zip_entry) . \n;

echo Compressed Size: . zip_entry_compressedsize($zip_entry) . 
\n;

echo Compression Method:  . zip_entry_compressionmethod($zip_entry) . 
\n;

 

if (zip_entry_open($zip, $zip_entry, r)) {

echo File Contents:\n;

$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));

echo $buf\n;

 

zip_entry_close($zip_entry);

}

echo \n;

 

}

 

zip_close($zip);

 

}

?

Error information:

Warning: zip_read() expects parameter 1 to be resource, integer given in 
D:\www…on line 6

Warning: zip_read() expects parameter 1 to be resource, integer given in 
D:\www…on line 23

I don’t know why? Who can explain it,thanks!

 

Regards!

R Evel