root/c3crm/sugarcrm/trunk/echoAllTables.php

Revision 997 (by hsr, 03/26/06 21:39:48)

new report with ajax

<?php header("Content-type: text/xml; charset:GBK"); ?>
<?php
echo "<?xml version=\"1.0\" encoding=\"GB2312\"?>";

 $GLOBALS['sugarEntry'] = true;
include_once('config.php');
require_once('log4php/LoggerManager.php');
require_once('include/database/PearDatabase.php');
//require_once('modules/Campaigns/Campaign.php');
require_once('include/utils.php');
//require_once('rico/util2.php');
require_once("gb2utf8/class.Chinese.php");
//require_once('modules/ACL/ACLController.php');
//require_once('modules/Campaigns/utils.php');

$GLOBALS['log'] = LoggerManager::getLogger('Report Designer');

$db = & PearDatabase::getInstance();

echo echoAllTables($db);

function echoAllTables($db)
{
	//$chineseArray = array();
	$shtml = "";
	$shtml .= "<response>";
	$query = "select * from tables_list";
	$result = $db->query($query);

	//$row = $db->fetchByAssoc($res);
	while($val = $db->fetchByAssoc($result,-1,false))
	{
		$shtml .= "<table>";
		
		//foreach (array_values($val) as $value)
		//{
			//$shtml .= $value";
		//}
		$shtml .= "<tablename>";
		//$chineseArray[] = $val['zh_comment'];
		$shtml .= $val['name'];
		$shtml .= "</tablename>";
		$shtml .= "<tablename_zh>";
		$shtml .= $val['zh_comment'];
		$shtml .= "</tablename_zh>";
		$shtml .= "</table>";
	}
	//return $content;
	$shtml .= "</response>";
	return $shtml;
}
?>
Note: See TracBrowser for help on using the browser.