使用方法:
function table($table, $field, $id) { global $dsql; $primarys = array(); $table = strpos($table, '#@_') === false?(strpos($table, 'dede_') === false?'cn_'.$table:str_replace('dede_','cn_',$table)):$table; $dsql -> Execute("me","SHOW COLUMNS FROM `$table`"); while ($r = $dsql->GetArray()) { if($r['Key'] == 'PRI') $primarys[] = $r['Field']; } if(!emptyempty($primarys)) { $primary = $primarys[0]; $result = $dsql -> GetOne("SELECT `$field` FROM `$table` WHERE `$primary`= $id"); } return isset($result[$field])?$result[$field]:''; }
新闻热点
疑难解答