Yes you are right. the script you have should work for one sheet. 
Sheet index starts with 0 not 1.
CheersMohammedBlog: http://jamandcheese-on-phptoast.com/Email: 
[email protected]: 012 139 5924

Date: Wed, 27 Jul 2011 10:22:10 +0800
Subject: Re: [phpug] PHP with Excel Sheet
From: [email protected]
To: [email protected]

Hi Mohammed,
Thanks for ur msg, and i wanna say something here and i need ur advice . 


1) i have 1 sheet only in my xls file, which is sheet 1. with 150 rows only. 

2) i think the 2 points u indicate here, its wont be a problem here. am i right?
im expecting ur advice on this.

thnx..
On Wed, Jul 27, 2011 at 6:51 AM, S.Mohammed Alsharaf <[email protected]> 
wrote:






Hi
If you search the reader php file, you will find a call to the val() function. 
There is a third parameter ' $sheet '. I think this is the sheet index. ' 
val($row,$col,$sheet=0) '


In the script below:1. $totalrow=$data->rowcount($sheet_index=0);
    you always returning the total number of rows in the first sheet

2. $data2=$data->val($startno+$i,2);    return the value at,    - row number 
$startno+$i
    - column number 2    - no sheet index specified. The default number is 0, 
which is the first sheet.


CheersMohammed
Blog: http://jamandcheese-on-phptoast.com/Email: [email protected]

> Date: Mon, 25 Jul 2011 22:38:27 -0700
> Subject: [phpug] PHP with Excel Sheet
> From: [email protected]
> To: [email protected]

> 
> Hi.
> 
>  im doing a php page which is retrieving data from xls sheet and its
> works well the xls sheet having 150 records. its limited to 20 records
> per page to show on result page .there is a search box and button to

> search some specific data , the search parameter giving the result
> from first page result only. i can't get result from full excel sheet.
> 
> $searchparameter=$_GET['searchparameter'];

> $totalrow=$data->rowcount($sheet_index=0);
> $rows=20;
> if ($_GET['page']!="")
> $page=$_GET['page'];
> 
> else
> $page=1;
> echo 'table';

> 
> 
> 
> $count=0;
> $recordno=1;
>       for($i=0;$i<$totalrow-6;$i++)
> {
> 
> if((($page-1)*$rows)<=$i && $i<=($page*$rows))
> {
> //$data1=$data->val($startno+$i,1);

> $data2=$data->val($startno+$i,2);
> $data3=$data->val($startno+$i,3);
> $data4=$data->val($startno+$i,6);
> 
> 
> if((stristr($data2,$searchparameter) ||
> stristr($data3,$searchparameter)|| stristr($data4,$searchparameter))||

> $searchparameter=="")
> {
> echo 'table';
> }
> 
> 
> i dont understan whats wrong here, y can't search full records on xls
> sheet.
> im expecting some ones help to solve my problem.

> thnxx..
> 
> -- 
> NZ PHP Users Group: http://groups.google.com/group/nzphpug
> To post, send email to [email protected]

> To unsubscribe, send email to
> [email protected]
                                          




-- 

NZ PHP Users Group: http://groups.google.com/group/nzphpug

To post, send email to [email protected]

To unsubscribe, send email to

[email protected]




-- 

NZ PHP Users Group: http://groups.google.com/group/nzphpug

To post, send email to [email protected]

To unsubscribe, send email to

[email protected]                                      

-- 
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

Reply via email to