<?php
require_once("db_table.php");
require_once("GetBrowserType.php");
//for ($sortcolno = 0; $sortcolno < 200; $sortcolno++)
//{
// $sorder = ${"sortorder".$sortcolno};
// if (isset($sorder))
// break;
//}
$tb = new db_table;
$brtype = new GetBrowserType;
$tb->db_type = 'postgres7'; // access, ado, ado_access, vfp, ibase,
// mssql, mysql, mysqlt, oci8, odbc, oracle, postgres, postgres7,
// sybase, db2, fbsql, ado_mssql, odbc_mssql
$tb->db_host = 'localhost';
$tb->db_user = 'xxxx'; // database username
$tb->db_pw = 'xxxx123'; // password
$tb->db_name = 'xxxx'; // database name
$tb->db_title = 'employee list'; // Table Title header
$tb->db_query = 'select lastname as "lastname ", firstname,
location, extension, cellphone as "cell ", email as "email (URL Link)" ';
$tb->db_from = ' from employeelist ';
$tb->max_rows = 1000;
//$tb->background = 'BGCOLOR=black';
//$tb->border_color = '#84ADE8'; // red, blue
//$tb->border_width = '8';
//$tb->table_style = 'BORDER="0" CELLPADDING="2" CELLSPACING="1"';
//$tb->cell_style = 'WIDTH="100" BGCOLOR="#cccccc"';
//$tb->content_style = 'STYLE="font: bold 10pt monospace; font-family: Arial; "';
//$tb->col_style[2] = 'BGCOLOR="red"';
//$tb->col_cell_style[2] = 'STYLE="font: bold 12pt monospace; background-color: red; "';
$tb->col_email_href[6] = 1; // 1 for email, 2 for href
if ($brtype->browser_type == 2 && $brtype->browser_version == 4) // netscape and version 4.x
{
// set border width to 0.0 for netscape 4.x
$tb->header_style = "style='background-color: yellow; font: bold 11pt monospace; font-family: Arial; font-weight: bold; border: solid #84ADE8; border-width: 0.0em ' ";
}
else
$tb->header_style = "style='background-color: yellow; font: bold 11pt monospace; font-family: Arial; font-weight: bold; border: solid #84ADE8; border-width: 0.3em ' ";
// reads value from form fieldname 'sortorder'
if (trim($sortorder) == '')
{
$sortorder = ' order by 1'; // default is - sort by 1st field
// Now construct the where condition
if (strlen(trim($FirstName)) > 0) // reads value from form fieldname 'FirstName'
{
if (strlen(trim($LastName)) > 0)
$tb->db_where = ' where upper(firstname) like upper(\'%' . $FirstName .
'%\') and upper(lastname) like upper(\'%' . $LastName . '%\') ';
else
$tb->db_where = ' where upper(firstname) like upper(\'%' . $FirstName . '%\') ';
}
else
{
if (strlen(trim($LastName)) > 0)
$tb->db_where = ' where upper(lastname) like upper(\'%' . $LastName . '%\') ';
}
}
else // user clicked sort field ...
{
$colno++;
$sortorder = ' order by ' . $colno;
// Remove back-slash \ before single-quote '
$db_where = stripslashes($db_where);
$tb->db_where = $db_where;
}
//print "<br> db_where is $db_where";
$tb->sortorder = $sortorder; // query order by statement
$tb->display();
php?>
|