0

My function which have code for table creation

   function hotel_install() {
        $path=ABSPATH . 'wp-config.php';
        require_once ($path);

        global $wpdb;
        $charset_collate = $wpdb->get_charset_collate();

        $sql_create_table = "CREATE TABLE '.$wpdb->prefix .'booking' (
          `id` int(11) NOT NULL auto_increment,
          `title` varchar(100) NOT NULL,
          `f_name` varchar(200) NOT NULL,
          `l_name` varchar(200) NOT NULL,
          `add` varchar(500) NOT NULL,
          `city` varchar(200) NOT NULL,
          `state` varchar(200) NOT NULL,
          `postal_code` int(11) NOT NULL,
          `country` varchar(200) NOT NULL,
          `phone` int(11) NOT NULL,
          `email` varchar(400) NOT NULL,
          `payment_by` int(11) NOT NULL,
          `additional_res` varchar(400) NOT NULL,
          `check_in` date NOT NULL,
          `check_out` date NOT NULL,
          `total_nights` int(11) NOT NULL,
          `total_rooms` int(11) NOT NULL,
          `numofadult` int(11) NOT NULL,
          `numofchild` int(11) NOT NULL,
          `room_num` int(11) NOT NULL,
          `room_id` int(11) NOT NULL,
          `paid_amount` int(11) NOT NULL
     ) $charset_collate; ";
 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta( $sql_create_table );



    }

My activation hook Code .

register_activation_hook(  __FILE__, array( $this, 'hotel_install' ) );

Meanwhile i followed fully standardize way But i am not getting any error nor i m getting any error.

  • see if this works pastebin.com/AVj4dr2w ( otherwise check with your activation hook, try getting the function to work ) – Samuel Elh Jul 28 '15 at 13:23
  • Sorry But your link isn't working for me . Kindly purpose some solution here – Hassan ALi Jul 29 '15 at 5:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.