Esempio n. 1
0
function userFollowQuery($follow_type, $query_type, $query_code)
{
    // 生成动态常量目标表名
    $table = constant('TB_BAS_USER_FOLLOW_' . strtoupper($follow_type));
    // 生成动态查询条件
    $condition = implode(' and ', arrayImplode($query_code, '=', "", "'"));
    // 生成动态查询方式并得到数据
    $data = M($table)->where($condition)->{$query_type}();
    // 返回数据
    return $data;
}
Esempio n. 2
0
function deleteTable($tabName, $condition)
{
    $table = M($tabName)->getTableName();
    $sql1 = "delete from " . $table . " where ";
    $sql2 = implode(' and ', arrayImplode($condition, '=', "", "'"));
    $sql = $sql1 . $sql2;
    $res = M()->execute($sql);
    if ($res === false) {
        return false;
    } else {
        return true;
    }
}