ZenDB conversion question

3 posts by 2 authors in: Forums > CMS Builder
Last Post: Thursday at 12:33pm   (RSS)

Hi Jeff, 

Glad to see you're trying out those new functions.  We have a built-in ZenDB function for that now: 

DB::tableExists($table)

Which does this internally: 

public static function tableExists(string $tableName): bool
{
    $fullTable = self::getFullTable($tableName);
    return self::query("SHOW TABLES LIKE ?", $fullTable)->count() > 0;
}

You can pass it a table with or without a table prefix, and it will add one if needed.

Hope that helps! Let me know any other questions.

Dave Edis - Senior Developer
interactivetools.com

Worked perfectly for my use case. Thank-you.

Jeff Shields