function s_db_primary($table, $id) { if (s_bad_string($table) || s_bad_id($id)) { return s_err_arg(); } if (defined("APP_DB_PREFIX")) { //替换表名:"%s_user:update" => "201204disney_user:update" $table = sprintf($table, APP_DB_PREFIX, true); } $sql = "select * from `{$table}` where `id`={$id} limit 1"; return s_db_row($sql); }
function s_db_primary($table, $id) { if (s_bad_string($table) || s_bad_id($id)) { return s_err_arg(); } $prefix = defined("APP_DB_PREFIX") ? APP_DB_PREFIX . "_" : ""; $sql = "select * from `{$prefix}{$table}` where `id`={$id} limit 1"; return s_db_row($sql); }