Beispiel #1
0

// $options["pagination"]["perPage"] = 10;  // 10 rows per page.
// $options["pagination"]["prev"] = "prev"; // "prev" link will be shown.
// $options["pagination"]["next"] = "next"; // "next" link will be shown.
// $options["pagination"]["linkCount"] = 2; //  2 links on each side of the current page.


$options["selects"] = array("color_id" => array("red" => 1, "green" => 2, "gold" => 3, "blue" => 4, "grey" => 5));             // Will output <option value="yes">yes</option>, etc.


$options["database"]["join"] = array("table" => "colors", "key" => "id", "foreign_key" => "color_id");

// Instanciates the table. This must be included here!

$table = new TableGear($options);



// If you need to use a custom query instead of the default (fetching everything), you can specify it here.
// You can use any syntax in the query you want, however you MUST include the primary key field in the SELECT
// clause, otherwise none of the editing functionality will work! Also, if you need pagination on the table
// you MUST include "SQL_CALC_FOUND_ROWS" after the SELECT clause and not have any LIMIT or ORDER BY clauses!
//
// $table->fetchData("SELECT SQL_CALC_FOUND_ROWS <FIELD1>,<FIELD2> FROM <DATABASE_TABLE> WHERE <etc..>");


//$table->fetchData("SELECT apples.id,name,color AS color_id from apples LEFT JOIN colors ON apples.color_id=colors.id");


// prev      = The text for the "prev" link. If null, no link will be shown.
// next      = The text for the "next" link. If null, no link will be shown.
// perPage   = How many rows to display per page.
// linkCount = How many links to display on either side of the current page. For example:
//             linkCount = 1, 10 pages, current page = 5 will result in:   4 5 6
//             linkCount = 2, 10 pages, current page = 5 will result in:   3 4 5 6 7
//             linkCount = 2, 10 pages, current page = 9 will result in:   7 8 9 10
//             etc...





// Instanciates the table. This must be included here!

$table = new TableGear($options);



// If you need to use a custom query instead of the default (fetching everything), you can specify it here.
// You can use any syntax in the query you want, however you MUST include the primary key field in the SELECT
// clause, otherwise none of the editing functionality will work! Also, if you need pagination on the table
// you MUST include "SQL_CALC_FOUND_ROWS" after the SELECT clause and not have any LIMIT or ORDER BY clauses!
//

$table->fetchData("SELECT SQL_CALC_FOUND_ROWS id,price,memory FROM labs_tablegear WHERE price > 400");




Beispiel #3
0
// You can use any syntax in the query you want, however you MUST include the primary key field in the SELECT
// clause, otherwise none of the editing functionality will work! Also, if you need pagination on the table
// you MUST include "SQL_CALC_FOUND_ROWS" after the SELECT clause and not have any LIMIT or ORDER BY clauses!
//
// $table->fetchData("SELECT SQL_CALC_FOUND_ROWS <FIELD1>,<FIELD2> FROM <DATABASE_TABLE> WHERE <etc..>");
$o2 = array();
$o2["database"] = array();
$o2["database"]["name"] = DATABASE_NAME;
$o2["database"]["username"] = DATABASE_USER;
$o2["database"]["password"] = DATABASE_PASS;
$o2["database"]["table"] = "tablegear";
$o2["database"]["utf8"] = true;
$query = "select SQL_CALC_FOUND_ROWS * from tablegear where description like 'a%'";
$table->fetchData($query);
$o2["database"]["noAutoQuery"] = true;
$t2 = new TableGear($o2);
$q2 = "select SQL_CALC_FOUND_ROWS * from tablegear where description like 'b%'";
$t2->fetchData($q2);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>TableGear for jQuery</title>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  <script type="text/javascript" src="../lib/javascripts/tablegear-jquery.js"></script>
  <link type="text/css" rel="stylesheet" href="../lib/stylesheets/tablegear.css" />
  <style type="text/css">

.wowzers {
  background-color: #ffe2e2;
//             etc...


 $options["pagination"]["perPage"] = 10;  // 10 rows per page.
 $options["pagination"]["prev"] = "prev"; // "prev" link will be shown.
 $options["pagination"]["next"] = "next"; // "next" link will be shown.
 $options["pagination"]["linkCount"] = 2; //  2 links on each side of the current page.



 $options["title"] = "Foo Table";


// Instanciates the table. This must be included here!

$table = new TableGear($options);



// If you need to use a custom query instead of the default (fetching everything), you can specify it here.
// You can use any syntax in the query you want, however you MUST include the primary key field in the SELECT
// clause, otherwise none of the editing functionality will work! Also, if you need pagination on the table
// you MUST include "SQL_CALC_FOUND_ROWS" after the SELECT clause and not have any LIMIT or ORDER BY clauses!
//
// $table->fetchData("SELECT SQL_CALC_FOUND_ROWS <FIELD1>,<FIELD2> FROM <DATABASE_TABLE> WHERE <etc..>");