Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




maybe_create_table [ WordPress Function ]

maybe_create_table ( $table_name, $create_ddl )
Parameters:
  • (string) $table_name Database table name to create.
  • (string) $create_ddl SQL statement to create table.
Returns:
  • (bool) If table already exists or was created by function.
Defined at:



{@internal Missing Short Description}}

{@internal Missing Long Description}}

Source


<?php
function maybe_create_table($table_name$create_ddl) {
    global 
$wpdb;
    if ( 
$wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name )
        return 
true;
    
//didn't find it try to create it.
    
$q $wpdb->query($create_ddl);
    
// we cannot directly tell that whether this succeeded!
    
if ( $wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name )
        return 
true;
    return 
false;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics