function __construct() { if (isset($_REQUEST["table_name"])) { vtorc($_REQUEST["table_name"]); //validate input } }
function SubLookupTable($_tbl_name = "") { vtorc($_tbl_name); //verify it's valid table name (commonfunc.php) if (!empty($_tbl_name)) { $this->tbl_name = $_tbl_name; $sql = "SHOW COLUMNS FROM " . $this->tbl_name; $result = mysql_query($sql); $cnt = 0; //first column is primary key and second is lookup value while ($row = mysql_fetch_array($result)) { if ($cnt == 0) { $this->prim_key_col = $row['Field']; } else { if ($cnt == 1) { $this->lookup_value_col = $row['Field']; } else { if ($cnt == 2) { $this->lookup_tbl_id_col = $row['Field']; } } } $cnt++; } } }
function set_table_name($_tbl_name) { vtorc($_tbl_name); //verify it's valid table name (commonfunc.php) if (!empty($_tbl_name)) { $this->tbl_name = $_tbl_name; } else { die("table cannot be empty: msg:2lk3mn;alksd78"); } }