Location: PHPKode > scripts > phpMyAccess > phpmyaccess-1.5.3/phpmyaccess/pma-tableinc.php
<?php

function do_header_filter_display($res) {
    $first = true;
    $eot = $GLOBALS['opt']['inc'];
    echo "    <!--// do_header_filter_display //--!>\n";
    if ($first AND $GLOBALS['opt']['fl']) {
      echo '    <tr>' . "\n";
      echo '      <td align="center"><input type="submit" name="apply" value="&gt;" /></td>'."\n";
      for ($k=0 ; $k<$GLOBALS['opt']['num_fds']; $k++) {
        $fieldname = $GLOBALS['fds'][$k];
        $l = 'qf'.$k;
        //do not display filter for the items that are not shown in the listview
        SetLinkOpt($fieldname,0);
        if ($GLOBALS['fdd'][$fieldname]["listview"] == true or !isset($GLOBALS['fdd'][$fieldname]["listview"])) {
          if ($GLOBALS['fdd'][$fieldname]['select'] == 'D' and $GLOBALS['fdd'][$fieldname]['boolean'] == false) {
            if (isset($GLOBALS['opt']['ttable'])  and isset($GLOBALS['opt']['tcolumn']) and isset($GLOBALS['opt']['tview'])) {
                $x = set_values_from_table($GLOBALS['opt']['db'],$GLOBALS['opt']['tb'].','.$GLOBALS['opt']['ttable'],$GLOBALS['opt']['ttable'].'.'.$GLOBALS['opt']['tcolumn'],
                                          $GLOBALS['opt']['ttable'].'.'.$GLOBALS['opt']['tview'],' WHERE ('.$GLOBALS['opt']['ttable'].'.'.$GLOBALS['opt']['tcolumn'].' = '.
                                          $GLOBALS['opt']['tb'].'.'.$fieldname.')');
            } else {
                $x = set_values_from_table($GLOBALS['opt']['db'],$GLOBALS['opt']['tb'],$fieldname);
            }
            echo "      <td><select name=$l size=\"1\">\n";
            if ($GLOBALS['opt'][$l] == '*') {
                echo '            <option value="*" selected>*</option>'."\n";
            } else {
                echo '            <option value="*">*</option>'."\n";
            }
            // display drop-down box
            for ($j=0; $j<count($x['option']); $j++)  {
                if ( $x['value'][$j] == $GLOBALS['opt'][$l] ) {
                  echo '            <option selected>'.$x['value'][$j].'</option>'."\n";
                } else {
                   echo '            <option>'.$x['value'][$j].'</option>'."\n";
                }
            }
            echo '          </select></td>'."\n";
            // normal text box
          } elseif ($GLOBALS['fdd'][$fieldname]['select'] == 'T') {

               echo DoSearchTextField($l, $GLOBALS['opt'][$l], $GLOBALS['fdd'][$fieldname]['length']);

          } elseif ($GLOBALS['fdd'][$fieldname]['select'] == 'D' and $GLOBALS['fdd'][$fieldname]['boolean'] == true) {

               echo DoBooleanSelectDropDown($l,$GLOBALS['opt'][$l]);

          } else {
               echo '      <td>&nbsp;</td>'."\n";
          }
        }
      }
      echo '    </tr>'."\n";
    }
}

function do_table_display($res) {
    // Main table data Display loop
    $first = true;
    $eot = $GLOBALS['opt']['inc'];
    echo "    <!--// do_table_display //--!>\n";
    while($row = mysql_fetch_array($res)) {

     echo '    <tr>' . "\n";

     if ($GLOBALS['opt']['select_recs']) {// If user is allowed to Change/Delete/Zoom records
        if ($first) {
           echo '      <td><input checked type="radio" name="rec" value="'.$row[$GLOBALS['opt']['key']].'" /></td>'."\n";
        } else {
           echo '      <td><input type="radio" name="rec" value="'.$row[$GLOBALS['opt']['key']].'" /></td>'."\n";
        }
     } elseif (stristr($GLOBALS['opt']['options'],'F')) {
          if (!$GLOBALS['opt']['doprint']) {
             echo '      <td>&nbsp;</td>'."\n";
          }
     }
      $first = false;
      for ($k=0 ; $k<$GLOBALS['opt']['num_fds']; $k++) {
          //we do not want to display fields that have their listview property set to false
          $fieldname = $GLOBALS['fds'][$k];
          if ($GLOBALS['fdd'][$fieldname]["listview"] == true or !isset($GLOBALS['fdd'][$fieldname]["listview"])) {
            if ((trim($row[$k])=='') or ($row[$k]=='NULL')) {
               echo '      <td>&nbsp;</td>'."\n";//editinline link should be added here
            } else {
              $row[$k]=nl2br(htmlentities($row[$k]));
              if ( (isset($GLOBALS['fdd'][$fieldname]['boolean'])) && ($GLOBALS['fdd'][$fieldname]['boolean']!=false) ) {
                  //  Show $GLOBALS['opt']['booltrue']/$GLOBALS['opt']['boolfalse'] for fields set as boolean
                  if ($row[$k]) {
                     echo '      <td>'.$GLOBALS['opt']['booltrue'].'</td>'."\n";//need to extend editinline to make this a pulldown
                  } else {
                     echo '      <td>'.$GLOBALS['opt']['boolfalse'].'</td>'."\n";
                  }
              } elseif ( (isset($GLOBALS['fdd'][$fieldname]['password'])) && ($GLOBALS['fdd'][$fieldname]['password']!=false) ) {
                  // Show stars for passwords
                  if ($row[$k]) {
                     echo '      <td>********</td>'."\n";
                  } else {
                     // arguably a risk, see options at top
                     echo '      <td>' . $GLOBALS['opt']['nopasswd'] . '</td>' ."\n";
                  }
              } elseif (isset($GLOBALS['fdd'][$fieldname]['URL'])) {//need to extend editinline to make this give option to edit or go to link.
                 // Make clickable items clickable
                 echo '      <td><a href="'.$GLOBALS['fdd'][$fieldname]['URL'].$row[$k].'">'.$row[$k].'</a></td>'."\n";
              } else {
                 if (strlen($row[$k])>= $GLOBALS['opt']['maxdisp']) {
                     echo '      <td>'.substr($row[$k],0,$GLOBALS['opt']['maxdisp']) . "....</td>\n";//would need to extend editinline to know to go GET the info
                 } else {
					if ($GLOBALS['opt']['select_recs']){
						echo '      <td onclick="editinline(\''.$GLOBALS['auth'].'\',\''.rawurlencode($GLOBALS['opt']['key']).'.'.rawurlencode($GLOBALS['opt']['tb']).'.'.rawurlencode($fieldname).'.';
						if ( (isset($GLOBALS['fdd'][$fieldname]['length'])) && ($GLOBALS['fdd'][$fieldname]['length']>0) ) {
							echo $GLOBALS['fdd'][$fieldname]['length'];
						} else {
							echo 'NULL';//null indicates length not defined
						}
						echo '.'.rawurlencode($row[$GLOBALS['opt']['key']]).'\',this)">'.$row[$k]."</td>\n";
                 	} else {								//NOTE: Possibly put notice in text below table, above buttons?
															//if ($GLOBALS['opt']['select_recs']) echo "All fields can be edited directly by clicking except passwords, URLs,  or fields longer than ".$GLOBALS['opt']['maxdisp']." characters";
						echo '      <td>'.$row[$k]."</td>\n";
					}
                 } 											
              }
            }
          }
          // echo "<td>$k</td>";
      }
      echo '    </tr>'."\n";
      // fixme : do we use this ?
      --$eot;
    }
}

function get_xls($res) {
  xlsStart();
  xlsInsertText( "Report Created on : " . date('Y-m-d') );
  xlsNewLine();
  xlsNewLine();
  $rcount = mysql_num_rows($res);
  xlsInsertText("Total Rows : " . $rcount);
  xlsNewLine();
  for ($k=0 ; $k<$GLOBALS['opt']['num_fds']; $k++) {
      $fd = $GLOBALS['fds'][$k];
      $fdn = $GLOBALS['fdd'][$fd]['name'];
      xlsInsertText($fdn);
  }
  xlsNewLine();

  while($row = mysql_fetch_row($res)) {
     while (list ($key, $val) = each ($row)) {
       // this is slightly iffy, but it seems to work well
       $dtype=doubleval($val);
       $stype=strval($val);
       if ($stype==strval($dtype)) {
           xlsInsertNumber($val);
       } else {
          if (strlen($val) > 255 ) {
              $val = substr($val, 1, 255);
              $truncs++;
          }
          if ($GLOBALS['fdd'][$fd]['password'] == true ) {
             xlsInsertText('********');
          } else {
             xlsInsertText($val);
          }
       }
     }
     xlsNewLine();
  }
  if ($truncs) {
     xlsInsertText($truncs . " Field(s) were truncated !!");
     xlsNewLine();
  }
  GetXls();
}

function do_table_button_display() {
  // note that <input disabled isn't valid HTML but most browsers support it
  $tmpstr = "    <!--// do_table_button_display //--!>\n";
  $tmpstr .= "  <hr />\n <div class=\"nav\"> <table summary=\"nav buttons\"><tr>\n";
  if ($GLOBALS['opt']['currpage'] > 1) {
       $tmpstr .=  '    <td><input type="submit" name="prev" value="Prev" /></td>'."\n";
  } else {
      $tmpstr .= '    <td><input disabled type="submit" name="dprev" value="Prev" /></td>'."\n";
  }
  if (stristr($GLOBALS['opt']['options'],'A')) {
      $tmpstr .= "    <td><input type=\"submit\" name=\"add\" value=\"Add\" /></td>\n";
  }
  if (!$GLOBALS['opt']['totalrecs']) {
     $buttonstate="disabled";
  }
  if (stristr($GLOBALS['opt']['options'],'C')) {
      $tmpstr .= "    <td><input $buttonstate type=\"submit\" name=\"$buttonstate" . "change\" value=\"Change\" /></td>\n";
  }
  if (stristr($GLOBALS['opt']['options'],'D')) {
      $tmpstr .= "    <td><input $buttonstate type=\"submit\" name=\"$buttonstate" . "delete\" value=\"Delete\" /></td>\n";
  }
  if (stristr($GLOBALS['opt']['options'],'Z')) {
      $tmpstr .= "    <td><input $buttonstate type=\"submit\" name=\"$buttonstate" . "zoom\" value=\"Zoom\" /></td>\n";
  }
  if ($GLOBALS['opt']['totalrecs'] > (2*$GLOBALS['opt']['inc'])) {
    if (stristr($GLOBALS['opt']['options'],'J')) {
       $tmpstr .= "    <td><input type=\"text\" size=\"5\" maxlength=\"5\" name=\"jumpto\" value=\"\" />\n";
       $tmpstr .= "    <input $buttonstate type=\"submit\" name=\"$buttonstate" . "jump\" value=\"Jump\" /></td>\n";
    }
  }
  if (stristr($GLOBALS['opt']['options'], 'Q')) {
      $tmpstr .= "    <td><input $buttonstate type=\"submit\" name=\"$buttonstate" . "query\" value=\"Query\" /></td>\n";
  }
  if (stristr($GLOBALS['opt']['options'], 'P')) {
      $tmpstr .= "    <td><input $buttonstate type=\"submit\" name=\"$buttonstate" . "print\" value=\"Print\" /></td>\n";
  }
  if (stristr($GLOBALS['opt']['options'], 'X')) {
      $tmpstr .= "    <td><input $buttonstate type=\"submit\" name=\"$buttonstate" . "xlsdump\" value=\"xls\" /></td>\n";
  }
  if ($GLOBALS['opt']['searchactive'] == 1) {
     $tmpstr .= "    <td><input $buttonstate type=\"submit\" name=\"$buttonstate" . "cfilter\" value=\"Clear Filter\" /></td>\n";
  }
  if ($GLOBALS['opt']['currpage'] < $GLOBALS['opt']['numpages']) {
     $tmpstr .= '    <td><input type="submit" name="next" value="Next" /></td>'."\n";
  } else {
     $tmpstr .= '    <td><input disabled type="submit" name="dnext" value="Next" /></td>'."\n";
  }
  return $tmpstr;
}

function ProcessState() {
  if ($GLOBALS['opt']['apply'] =='>') {
      $GLOBALS['opt']['fm']=0;
  }
  if (!$GLOBALS['opt']['fm']) {
     $GLOBALS['opt']['fm'] = 0;
  }
  if ($GLOBALS['opt']['prev'] == 'Prev'){
    $GLOBALS['opt']['fm'] = $GLOBALS['opt']['fm'] - $GLOBALS['opt']['inc'];
    if ($GLOBALS['opt']['fm'] < 0) {
      $GLOBALS['opt']['fm'] = 0;
    }
  }
  if ($GLOBALS['opt']['next'] == 'Next') {
     $GLOBALS['opt']['fm'] = $GLOBALS['opt']['fm'] + $GLOBALS['opt']['inc'];
  }

  if (!$GLOBALS['opt']['fl']) {
    $GLOBALS['opt']['fl'] = 0;
  } /*by default, no filters*/
  if ($GLOBALS['opt']['sw']) { /*filter switch has been pressed*/
    if ($GLOBALS['opt']['sw'] == 'v') {$GLOBALS['opt']['fl'] = 1;}
    if ($GLOBALS['opt']['sw'] == '^') {$GLOBALS['opt']['fl'] = 0;}
  }
  // sort order default
  if ($GLOBALS['opt']['sfn'] == '') {
    $GLOBALS['opt']['sfn'] = 0;
    $GLOBALS['opt']['sortkey'] = 0;
  }

  if (substr($GLOBALS['opt']['sfn'],0,1)== '-' ) {
     // descending sort order is flagged by a minus sign*/
     $GLOBALS['opt']['sort_asc'] = 0;
     $GLOBALS['opt']['sortkey'] = substr($GLOBALS['opt']['sfn'],1);
  } else {
     $GLOBALS['opt']['sort_asc'] = 1;
     $GLOBALS['opt']['sortkey'] = $GLOBALS['opt']['sfn'];
  }
  pma_debug( "Sortkey =". $GLOBALS['opt']['sortkey'] . "sort_asc =" .$GLOBALS['opt']['sort_asc']);
}

function DoLinkColumnHeaders() {
  // we need an initial column if we have filters, or Changes or Deletes enabled
  // This is the radio select button as first column
  if (stristr($GLOBALS['opt']['options'],'F') or $GLOBALS['opt']['select_recs']) {
     if (stristr($GLOBALS['opt']['options'],'F')) {
        if ($GLOBALS['opt']['fl']) {
           echo '      <th align="center"><input type="submit" name="sw" value="^" /></th>'."\n";
        } else {
           echo '      <th align="center"><input type="submit" name="sw" value="v" /></th>'."\n";
        }
     } else {
        echo '      <th align="center">&nbsp;</th>'."\n";
     }
  }
  // column sort links
  for ($k=0 ; $k<$GLOBALS['opt']['num_fds']; $k++) {
    $fd = $GLOBALS['fds'][$k];
    //we do not want to display fields that have listview property set to false
    if ($GLOBALS['fdd'][$fd]["listview"] == true or !isset($GLOBALS['fdd'][$fd]["listview"])) {
        $fdn = $GLOBALS['fdd'][$fd]['name'];
        if ($GLOBALS['fdd'][$fd]['sort']) {
           // clicking on the current sort field reverses the sort order
           if (($k==$GLOBALS['opt']['sfn']) and ($GLOBALS['opt']['sort_asc'])) {
              echo '      <th><a href="'.$GLOBALS['opt']['self'].'?fm=0&fl='.$GLOBALS['opt']['fl'].'&sfn=-'.$k.$GLOBALS['opt']['qfn'].'">'.$fdn.'</a></th>'."\n";
           } else {
              echo '      <th><a href="'.$GLOBALS['opt']['self'].'?fm=0&fl='.$GLOBALS['opt']['fl'].'&sfn='.$k.$GLOBALS['opt']['qfn'].'">'.$fdn.'</a></th>'."\n";
           }
        } else {
           echo '      <th>'.$fdn.'</th>'."\n";
        }
    }
  }
  echo '    </tr>'."\n";
}

function DoPrintColumnHeaders() {
  echo '    <tr>'."\n";
  for ($k=0 ; $k<$GLOBALS['opt']['num_fds']; $k++) {
    $fd = $GLOBALS['fds'][$k];
    //we do not want to display fields that have listview property set to false
    if ($GLOBALS['fdd'][$fd]["listview"] == true or !isset($GLOBALS['fdd'][$fd]["listview"])) {
       $fdn = $GLOBALS['fdd'][$fd]['name'];
       echo '      <th>'.$fdn.'</th>'."\n";
    }
  }
  echo '    </tr>'."\n";
}

function Create_Query () {
  //  Prepare the SQL Query from the data definition file
  $qry = create_column_list($GLOBALS['opt']['tb'],$GLOBALS['fdd']);
  //  Even if the key field isn't displayed, we still need its value
  if ($GLOBALS['opt']['select_recs']) {
     if (!in_array($GLOBALS['opt']['key'],$GLOBALS['fds'])) {
        $qry = $qry.','.fully_qualified_name($GLOBALS['opt']['tb'],$GLOBALS['fdd'],$GLOBALS['opt']['key'], "view");
     };
  }
  $qry = $qry.create_from_clause($GLOBALS['opt']['tb'],$GLOBALS['fdd']);

  $qry_select = create_where_clause($GLOBALS['opt']['tb'],$GLOBALS['fdd']);
  if ($qry_select=='') {
    $kwd = ' WHERE ';
  } else {
    $kwd = ' AND ';
  }
  for ($k=0 ; $k<$GLOBALS['opt']['num_fds']; $k++) {
    $l='qf'.$k;
    $afilter = $GLOBALS['opt'][$l];
    if (($afilter != '') AND ($afilter != '*')) {
       if (strstr($afilter,'*')) {
          $afilter = str_replace('*','%',$afilter);
          $qry_select = $qry_select.$kwd.' ('.fully_qualified_name($GLOBALS['opt']['tb'],$GLOBALS['fdd'],$GLOBALS['fds'][$k],'view')." like '".$afilter."') ";
       } else {
          $qry_select = $qry_select.$kwd.' ('.fully_qualified_name($GLOBALS['opt']['tb'],$GLOBALS['fdd'],$GLOBALS['fds'][$k],'view')." = '".$afilter."') ";
       }
       $kwd = ' AND ';
       unset($afilter);
    }
  }

  // preselecting a range of records
  if ($GLOBALS['opt']['presel'] == true) {
     if ($GLOBALS['opt']['preselval']) {
	  if ($qry_select=='') { $kwd = ' WHERE '; } else { $kwd = " AND "; } 
      $qry_select = $qry_select.$kwd."(" . $GLOBALS['opt']['preselfld'] . "='" . $GLOBALS['opt']['preselval'] . "') ";
      #$qry_select .= " AND (" . $GLOBALS['opt']['preselfld'] . "='" . $GLOBALS['opt']['preselval'] . "') ";
     }
  }
  if ($GLOBALS['opt']['presel1'] == true) {
     if ($GLOBALS['opt']['preselval1']) {
	  if ($qry_select=='') { $kwd = ' WHERE '; } else { $kwd = " AND "; } 
      $qry_select = $qry_select.$kwd."(" . $GLOBALS['opt']['preselfld1'] . "='" . $GLOBALS['opt']['preselval1'] . "') ";
      #$qry_select .= " AND (" . $GLOBALS['opt']['preselfld1'] . "='" . $GLOBALS['opt']['preselval1'] . "') ";
     }
  }

  $qry = $qry.$qry_select;

  if ($GLOBALS['opt']['sortkey']) {
     $qry = $qry.' ORDER BY '.fully_qualified_name($GLOBALS['opt']['tb'],$GLOBALS['fdd'],$GLOBALS['fds'][$GLOBALS['opt']['sortkey']],'view');
     if ($GLOBALS['opt']['sort_asc']) {
        $qry = $qry.' ASC';
     } else {
        $qry = $qry.' DESC';
     }
  } else {
     if ($GLOBALS['opt']['sort_asc']) {
        $qry = $qry.' ORDER BY '. $GLOBALS['opt']['key'] . ' ASC';
     } else {
        $qry = $qry.' ORDER BY '. $GLOBALS['opt']['key'] . ' DESC';
     }
  }

  $GLOBALS['opt']['qry'] = $qry;
  $GLOBALS['opt']['qry_select'] = $qry_select;
}

function SetRecordCount() {
  $GLOBALS['opt']['totalrecs'] = 0;
  $qrycnt = 'select count(*) as nbrecno '.create_from_clause($GLOBALS['opt']['tb'],$GLOBALS['fdd']).$GLOBALS['opt']['qry_select'];
  $res = mysql_db_query($GLOBALS['opt']['db'],$qrycnt);
  if ($res) {
    list($GLOBALS['opt']['totalrecs']) = mysql_fetch_row($res);
  } else {
    echo "No Records found<br/>\n";
    pma_debug ("Page count SELECT: " . mysql_errno().": ".mysql_error());
  }
}

function fix_pagenums() {
  // fix up the new page number if jumpto is used
  // fix up hidden var in html too
  if ($GLOBALS['opt']['jumpto']) {
    if ($GLOBALS['opt']['jumpto'] >= $GLOBALS['opt']['totalrecs']) {
        $GLOBALS['opt']['fm']=$GLOBALS['opt']['totalrecs']-$GLOBALS['opt']['inc'];
    } else if ($GLOBALS['opt']['jumpto'] <= 0) {
        $GLOBALS['opt']['fm']=0;
    } else {
        $GLOBALS['opt']['fm']=floor($GLOBALS['opt']['jumpto']/$GLOBALS['opt']['inc']) * $GLOBALS['opt']['inc'];
    }
  }
  $GLOBALS['opt']['currpage'] = ($GLOBALS['opt']['fm']/$GLOBALS['opt']['inc'])+1;
  $GLOBALS['opt']['numpages'] = Ceil($GLOBALS['opt']['totalrecs']/$GLOBALS['opt']['inc']);
}

function do_display_table() {
  echo "    <!--// do_display_table //--!>\n";

  /* Process any navigation buttons etc */
  ProcessState();

  // If user is allowed to Change/Delete/Zoom records, we need an extra column
  // to allow users to select a record, so select_recs is set

  $GLOBALS['opt']['select_recs'] = ( (stristr($GLOBALS['opt']['options'],'C') or stristr($GLOBALS['opt']['options'],'D') or
             stristr($GLOBALS['opt']['options'],'Z')) and ($GLOBALS['opt']['key'] != ''));

  // get our main query, including filters etc into $GLOBALS['opt'][] defines qry, qry_select
  Create_Query();

  // make sure $GLOBALS['opt']['fm'] is defined
  if (!$GLOBALS['opt']['fm']) {
     $GLOBALS['opt']['fm'] = 0;
  }

  // Find out how many records there are for the "jump to" facility
  // and fix up page number
  SetRecordCount();
  fix_pagenums();

  // ----- Form html output start

  echo '<form action="'.$GLOBALS['opt']['self'].'" method="post">'."\n";

  echo '  <div class="data"> <table border="1" cellpadding="1" cellspacing="0" summary="'.$GLOBALS['opt']['tb'].'">'."\n";
  echo "    <tr>\n";

  //  V ^ and sort stuff for headers
  DoLinkColumnHeaders();

  $GLOBALS['opt']['qry'] = $GLOBALS['opt']['qry'].' LIMIT '.$GLOBALS['opt']['fm'].','.$GLOBALS['opt']['inc'];

  pma_debug ("main table query :".$GLOBALS['opt']['qry'] );

  $res = mysql_db_query($GLOBALS['opt']['db'],$GLOBALS['opt']['qry']);

  if (!$res) {
    echo "No Records found<br/>\n";
    pma_debug ("mysql : ". mysql_errno().": ".mysql_error() );
  } else {
    do_header_filter_display($res);
    do_table_display($res);
  }
  echo "  </table></div><br><br>\n";

  echo do_table_button_display();

  /*
    Display the current page and the total pages
  */
  echo '    <td>&nbsp;</td>'."\n";

  echo '    <td>&nbsp;Page: '.$GLOBALS['opt']['currpage'] . ' / '.$GLOBALS['opt']['numpages'].'  ( Page size : ' . $GLOBALS['opt']['inc'] .' ) </td>'."\n";
  echo '    <td>&nbsp;Records: '.$GLOBALS['opt']['totalrecs'].'</td>'."\n";
  echo '  </tr></table>'."\n";

  save_form_state();

  echo '</form>'."\n";
}

function do_display_Print_table() {
  $GLOBALS['opt']['inc'] = $GLOBALS['opt']['maxprintrows'];

  echo "    <!--// do_display_Print_table //--!>\n";
  // ----- Form html output start
  echo '  <div class="data"> <table border="1" cellpadding="1" cellspacing="0" summary="'.$GLOBALS['opt']['tb'].'">'."\n";

  DoPrintColumnHeaders();

  Create_Query();

  $GLOBALS['opt']['qry'] = $GLOBALS['opt']['qry'].' LIMIT '.$GLOBALS['opt']['fm'].','.$GLOBALS['opt']['inc'];

  pma_debug ("main table query :".$GLOBALS['opt']['qry'] );

  $res = mysql_db_query($GLOBALS['opt']['db'],$GLOBALS['opt']['qry']);

  if (!$res) {
     echo "No Records found<br/>\n";
     pma_debug( "Mysql: " . mysql_errno().": ".mysql_error() );
  } else {
    // switch off radio buttons
    $GLOBALS['opt']['select_recs'] = 0;
    do_table_display($res);
  }
  echo "  </table></div><br><br>\n";
}

function do_get_xls() {
  Create_Query();

  $res = mysql_db_query($GLOBALS['opt']['db'],$GLOBALS['opt']['qry']);

  if (!$res) {
     pma_errpage ( "No Records found <br/> \n Mysql: " . mysql_errno().": ".mysql_error() );
  } else {
     get_xls($res);
  }
}

?>
Return current item: phpMyAccess