Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

TableGear - PHP includes

Posted on 2012-04-01
4
938 Views
Last Modified: 2012-04-20
Hi,

I am using TableGear: http://andrewplummer.com/code/tablegear/

index.php code:
<table border="0" bordercolor="" width="100%" cellpadding="3" cellspacing="3">
	<tr>
		<td width="50%"><?php include("inactive-sites.php"); ?></td>
		<td width="50%"><?php include("active-sites.php"); ?></td>
	</tr>
</table>

Open in new window


inactive-sites.php and active-sites.php are technically php grids from TableGear with 2 different select statements. However, when I do so, only inactive-sites.php shows up but not active-sites.php

However, when I run both the scripts independently, they works fine. Here is the code for inactive-sites.php

<?php

include("scripts/tablegear/include/TableGear1.6.1.php");
include("constants.php");

$database_table = "mysites";

$options = array();
$options["database"] = array();
$options["pagination"] = array();

// Database host: if omitted defaults to localhost.
$options["database"]["host"]        = $database_host;

// Basic database information. These are required.

$options["database"]["name"]        = $database_name;
$options["database"]["username"]    = $database_username;
$options["database"]["password"]    = $database_password;
$options["database"]["table"]       = $database_table;

// -- Row Deletion
$options["allowDelete"] = false;

// -- Default Sort
$options["database"]["sort"]       = array("domainname", "expirydate");   // Sorting on multiple fields.

// -- Database Fields
//
// This option will limit the fields selected in the auto query to those specified in the array.
// Also note that if you are using a custom query with fetchData (below) and are limiting the fields
// returned in that query, you MUST specify those exact fields here as well if you want to be able
// to add new rows!
// $options["database"]["fields"]   = array("<FIELD1>", "<FIELD2>");

// -- noAutoQuery (for custom queries)
//
// This will prevent the default query (which selects all fields in the table) from being run automatically.
// Turn this on when using custom queries (fetchData). Note that "table" above is still necessary for
// update/insert to work.
$options["database"]["noAutoQuery"] = true;

// -- Editable fields.
// Defaults to all except the auto increment field.
// $options["editable"]  = array("<FIELD1>", "<FIELD2", "ETC...");


// -- Select Elements
// $options["selects"] = array("<FIELD>" => array("yes", "no"));             // Will output <option value="yes">yes</option>, etc.
$options["selects"] = array("status" => array("active","inactive"));

// -- Totals
// You can add totals to the bottom of the table by adding the "totals" option here.
//$options["totals"] = array("memory","number");

// -- Pagination
$options["pagination"]["perPage"] = 100;  // 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"] = 20; //  2 links on each side of the current page.

// Instanciates the table. This must be included here!
$table1 = new TableGear($options);

$table1->fetchData("SELECT SQL_CALC_FOUND_ROWS id,sitename,status,notes,id from mysites where status='inactive'");
?>

<!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="scripts/tablegear/javascripts/TableGear1.6.1-jQuery.js"></script>
  <link type="text/css" rel="stylesheet" href="scripts/tablegear/stylesheets/tablegear.css" />
</head>
<body>
  <div>
    <?php $table1->getTable() ?>
  </div>
<?php $table1->getJavascript("jquery") ?>
</body>
</html>

Open in new window

0
Comment
Question by:nainil
  • 2
4 Comments
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 37793334
Check if in active-sites.php you use $table1 as in inactive-sites.php: if so, change all its occurrences to $table2

Hope this helps
Cheers
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 37793337
Please post the URL that shows this in action, thanks.
0
 

Accepted Solution

by:
nainil earned 0 total points
ID: 37849745
I found the solution reading the forum for TableGear. All set.
0
 

Author Closing Comment

by:nainil
ID: 37869842
I did some more googling and found the solution on the Forum for TableGear.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Why is my wamp get_include_path() wrong? 2 21
How to fix Datetime in MySQL? 4 47
AJAX pass along a variable 3 46
PHP Mail error 3 26
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question