Jump to content

RRVARMA

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Everything posted by RRVARMA

  1. Hi, I'm facing problem with the script below. Actually its a pagination where the user can download any page he wishes. Here i've put only 'Previous1'. But there are Next page, Last Page and First Page links. The problem i'm facing is : Once i click the download to Excel, and then click the 'PREVIOUS PAGE' link its again activating the download thing. As i'm new to this PHP i'm not able to understand why its not working properly. Download to excel link is working properly. Previously before adding the download to excel link everything was fine with the pagination thing. But problem raised when i put the script for downloading the reports to excel. Please help. <FORM name='form1' method=post action=pineapple.php> <INPUT TYPE=HIDDEN name=ExcelLink value="off"> <INPUT TYPE=HIDDEN name=Previous1 value="off"> <INPUT TYPE=HIDDEN name=Next2 value="off"> <INPUT TYPE=HIDDEN name=first1 value="off"> <INPUT TYPE=HIDDEN name=last2 value="off"> ------------ ------------ <?php if(strtolower($Previous1) == "on") { $TOTAL_ROWS= $MAX_ROWS - $start2 + 1; $start2= $start2 - $TOTAL_ROWS; $MAX_ROWS= $MAX_ROWS - $TOTAL_ROWS; } if(strtolower($ExcelLink) == "on") { Header("Content-Type: application/vnd.ms-excel"); Header("Content-Disposition: attachment; filename=Total_Fruits_Month.xls"); } -------------------------- -------------------------- ##########other actual scripts which doesn't concern the current prob.############## -------------------------- -------------------------- if(strtolower($ExcelLink) != "on") { echo "<CAPTION><BODY><COLOR=#0000CF><A href=\"javascript:this.document.form1.Previous1.value='on';this.document.form1.submit();\">PREVIOUS PAGE</A></CAPTION> "; echo "<CENTER><BODY><A href=\"javascript:this.document.form1.ExcelLink.value='on';this.document.form1.submit();\">Download</A> to Excel"; } ?> </FORM> Thanks, RRVARMA
  2. Hi, Please tell me how to find the total number of rows fetched my a query. I'm getting the rows from Teradata and not using MySql. i tried with the following but in vain.. //$rows=odbc_num_rows($query); //echo $rows; //$rows= "SELECT count(*) as result FROM (".$query.")"; //echo $rows; //$num_rows = mysql_num_rows($query); //echo $num_rows; $totrows=odbc_fetch_row($query); echo $totrows; //$totrows=ROW_COUNT($query); //echo $totrows; Please help.. Thanks, RRVARMA
  3. Hi, I'm new to PHP but tryin hard to learn it.. Here i'm tryin to implement pagination in my web page but am not able to change the variable value whn i click NEXT PAGE link. Please help. A part of the script is shown below. <?php $ENDING_ROW=$MAX_ROWS; //This MAX_ROWS is received from previous page. ex., index.php ?> <INPUT TYPE=HIDDEN name=ENDING_ROW value="<?php echo $MAX_ROWS; ?>"> <FORM name='form1' method=post action=pineapple23.php> <INPUT TYPE=HIDDEN name=ExcelLink value="off"> <INPUT TYPE=HIDDEN name=MAX_ROWS value="<?php echo $MAX_ROWS; ?>"> <INPUT TYPE=HIDDEN name=start2 value="<?php echo $start2; ?>"> <INPUT TYPE=HIDDEN name=checkbox_same_state value="<?php echo $checkbox_same_state; ?>"> </FORM> <?php if(strtolower($Next2) == "on") { $start2= $start2 + $MAX_ROWS; // start2 is initialized to 1 from the previous page ie, index.php $ENDING_ROW= $ENDING_ROW + $MAX_ROWS; } ................................. .............................. ..................................... $query = "select $select_customer $select_from_state $select_to_state FROM FRUITS_IMPORTS WHERE $CUSTOMER_NAME_Condition $FROM_STATE_Condition $TO_STATE_Condition GROUP BY $group_by_customer $group_by_from_state $group_by_to_state qualify row_number() over ($group_by_customer $group_by_from_state $group_by_to_state) between $start2 and $ENDING_ROW"; <?php ................................. .............................. ..................................... { echo "<CENTER><BODY><align right><A href=\"javascript:this.document.form1.Next2.value='on';this.document.form1.submit();\">NEXT PAGE</A> "; } ?> If the MAX_ROWS selected from the previous page is 10, then during the first run the rows shown is from 1 to 10. Then when i click NEXT PAGE it gives me rows from 11 to 20. But after that when i click NEXT PAGE again it gives the same 11 to 20 rows. So, please tell me how to change the values of 'start2' and 'ENDING_ROW' when i click NEXT PAGE. Thanks, RRVARMA.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.