Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as PHP by registered user mruoppolo ( 10 years ago )
function teste_install() {
    global $wpdb;
    $table_name = $wpdb->prefix . "loteria";
    $table_name2 = $wpdb->prefix . "loteria_num";
 $charset_collate = $wpdb->get_charset_collate();

 $sql = "CREATE TABLE $table_name (
   loteria_id int(11) NOT NULL AUTO_INCREMENT,
   loteria_data date DEFAULT '0000-00-00' NOT NULL,
   loteria_concurso int(11) NOT NULL,
   PRIMARY KEY  (loteria_id)
 ) $charset_collate;";

 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
 dbDelta( $sql );

 $sql2 = "CREATE TABLE $table_name2 (
   loteria_num_id int(11) NOT NULL AUTO_INCREMENT,
   loteria_id int(11) NOT NULL,
   loteria_num int(11) NOT NULL,
   PRIMARY KEY  (loteria_num_id)
 ) $charset_collate;";

 dbDelta( $sql2 );

 $insertLoteria = "INSERT INTO $table_name (loteria_id, loteria_concurso, loteria_data) VALUES
(1, 1404, 2016-08-22),
(3, 1405, 2016-08-24),
(4, 1406, 2016-08-26),
(5, 1407, 2016-08-29),
(6, 1408, 2016-09-06),
(7, 1409, 2016-09-09),
(8, 1410, 2016-09-12),
(9, 1411, 2016-09-14),
(10, 1412, 2016-09-16),
(11, 1413, 2016-09-19),
(12, 1414, 2016-09-21);";

   $wpdb->query($wpdb->prepare( $insertLoteria ));
}

 

Revise this Paste

Parent: 81591
Your Name: Code Language: