"; if ( strlen( $value) < 40) { $$header = $value; } } if ( isset( $_SERVER['REMOTE_USER'])) { $user = $_SERVER['REMOTE_USER']; } include_once( "../db.config.php"); $maxPerPage = $_GET['max']; $maxPerPage = max( 50, $maxPerPage); $maxPerPage = min( 0150, $maxPerPage); $currentPage = $_GET['num']; $currentPage = max( 1, $currentPage); $filter = max( 2000, $filter); $filter = min( $year, $filter); // print $filter . "

" . $sort . "

"; ?> BROWSE and EDIT

BROWSE and EDIT

This is a demo of the basics of database programming.

Functionality

  • Browse a table or part of a table.
  • Pick a row to view or edit.
  • Change the sort order.
  • Change the filter.
  • Add a row.


= "2000" && $filter <= 2009 ) { $filterstr = " where year = " . $filter . " and place < 300"; $filter_request = "&filter=" . $filter; } $limitclause = " limit " . (($currentPage-1) * $maxPerPage) . "," . $maxPerPage; // " offset " . (($currentPage-1) * $maxPerPage); $cntH = mysql_query ( "select count(*) as totalRows from race where year = 2002 "); $cntArr = mysql_fetch_assoc( $cntH); $totalRows = $cntArr['totalRows']; $selstring = "select race.* from race " . $filterstr . " order by " . $sortstr . $limitclause; // echo "

debug


$selstring


"; $query_handle = mysql_query( $selstring); if (mysql_errno() > 0) { echo "\n" . mysql_errno(). ": " . mysql_error() . "
"; } // find out how many rows were returned $num_rows = mysql_num_rows ($query_handle); if (1==1) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo ""; echo "\n"; for ( $i = 0; $i < $num_rows; $i++) { echo " \n"; $row = mysql_fetch_array ($query_handle); $tmpstr = $row['place'] . "&year=" . $row['year']; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } echo "
PlaceNameHometownTimeYear
" . $row['place'] . " " . $row['name'] . "" . $row['town'] . "" . $row['timeval'] . "" . $row['year'] . "
\n"; } print "

"; print "These buttons show how you can rapidly and easily page " . "through the data which is sorted by place of finish


\n"; showNewsFooter( $totalRows, $maxPerPage, $currentPage); ?>