ZenDB conversion question

3 posts by 2 authors in: Forums > CMS Builder
Last Post: December 19   (RSS)

I have an existing function to test if a table exists.:

function testIfTableExists($table)
{
    global $TABLE_PREFIX;

    $sql = "SHOW TABLES LIKE '$TABLE_PREFIX$table'";
    $val = mysqli()->query($sql);
    return mysqli()->affected_rows > 0 ? true : false;
}

I am trying to update it to DB::query($sql), but the result is an empty array. Running the query in the MySQL console shows a single result with the table name. 

Using ZenDB, what would be the recommended way to test if a table exists?

Instead of reinventing the wheel, is there a CMSB function determining whether a table exists?

Jeff Shields
yaadev.com

Worked perfectly for my use case. Thank-you.

Jeff Shields
yaadev.com