From: Eric F. <wg...@us...> - 2004-08-11 00:18:52
|
Update of /cvsroot/phpliteadmin/phpLiteAdmin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3171 Modified Files: tbl.php5 Log Message: Optimized and fixed CSS issues. Still has one problem with CSS in tables with many fields. Index: tbl.php5 =================================================================== RCS file: /cvsroot/phpliteadmin/phpLiteAdmin/tbl.php5,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- tbl.php5 10 Aug 2004 23:04:20 -0000 1.2 +++ tbl.php5 11 Aug 2004 00:18:42 -0000 1.3 @@ -61,6 +61,8 @@ case 'browse': print '<?xml-stylesheet href="style/tbl_browse.xsl" type="text/xsl" ?>' . "\n"; print '<rows>' . "\n"; + print "\t<db>$db_name</db>\n"; + print "\t<tbl>$tbl</tbl>\n"; if( isset( $_REQUEST['order'] ) ) { @@ -70,49 +72,39 @@ { $order = 'ASC'; } - - $order_by = ( isset( $_REQUEST['order_by'] ) ) ? ' ORDER BY ' . $_REQUEST['order_by'] . " $order" : ''; - $start = ( isset( $_REQUEST['start'] ) ) ? settype( $_REQUEST['start'], 'integer' ) : 0; - $end = ( isset( $_REQUEST['end'] ) ) ? settype( $_REQUEST['end'], 'integer' ) : $config['default_rows']; + + $order_by = ( isset( $_REQUEST['order_by'] ) ) ? " ORDER BY " . $_REQUEST['order_by'] . " $order" : ''; + + $offset = ( isset( $_REQUEST['offset'] ) ) ? settype( $_REQUEST['offset'], 'integer' ) : 0; + $limit = ( isset( $_REQUEST['limit'] ) ) ? settype( $_REQUEST['limit'], 'integer' ) : $config['default_rows']; $sql = "SELECT * FROM $tbl - $order_by"; - //LIMIT $start, $end"; + $order_by + LIMIT $limit OFFSET $offset"; $result = $Database->query( $sql ); - $columns_array = array(); + $rows = $Database->fetch_all( $result ); + $columns = $Database->fetch_column_types( $tbl ); - while( $row = $Database->fetch_array( $result ) ) + foreach( $columns as $name => $type ) { - print "\t<row>\n"; - - foreach( $row as $key => $value ) + print "\t" . '<column name="' . $name . '">' . "\n"; + + for( $i = 0; $i < count($rows); $i++ ) { - if ( !( in_array( $key, $columns_array ) ) ) - { - $columns_array[] = $key; - } - - print "\t\t" . '<column name="' . $key . '">' . $value . '</column>' . "\n"; - print "\t\t<tbl>$tbl</tbl>\n"; - print "\t\t<db>$db_name</db>\n"; + print "\t\t" . '<row id="' . $i . '">' . "\n"; + print "\t\t\t" . '<value>' . $rows[$i][$name] . '</value>' . "\n"; + print "\t\t</row>\n"; } - print "\t</row>\n"; + print "\t</column>\n"; } - if( count( $columns_array ) ) + for( $i = 0; $i < count($rows); $i++ ) { - print "\t<columns>\n"; - - for( $i = 0; $i < count( $columns_array ); $i++ ) - { - print "\t\t<name>" . $columns_array[$i] . "</name>\n"; - } - - print "\t</columns>\n"; + print "\t<number>$i</number>\n"; } print "</rows>\n"; |