function table($table, $field, $id)
{
global $dsql;
$primarys = array();
$table = strpos($table, '#@_') === false?(strpos($table, 'dede_') ===false?''.$table:str_replace('dede_','',$table)):$table;
$dsql -> Execute("me","SHOW COLUMNS FROM `$table`");
while ($r = $dsql->GetArray())
{
if($r['Key'] == 'PRI') $primarys[] = $r['Field'];
}
if(!empty($primarys))
{
$primary = $primarys[0];
$result = $dsql -> GetOne("SELECT `$field` FROM `$table` WHERE `$primary`= $id");
}
return isset($result[$field])?$result[$field]:'';
}
|