Custom Fields
Re-Envisioned
Support MB Custom Table I need to know what Data Type I can use in MB Custom Table

  • Creator
    Topic
  • #12485
    Resolved Jefferson
    Participant

    I have found some problems to use MB Custom Table with specific data type. I will appreciate to see in the documentation the list of data types that are allowed.

    Above a piece of code. This code generates a custom table. The metabox save the data into this table, but I can not recover just some data on the front.

    MB_Custom_Table_API::create( "{$wpdb->prefix}classified_meta", array(
      'owner_id' => 'INT',
      'direct_sale'   => 'TINYINT(1) NOT NULL',
      'inspection_id' => 'INT',
      'manufacture_year' => 'YEAR(4)',
      'model_year' => 'YEAR(4)',
      'gearbox' => 'VARCHAR(64)',
      'engine' => 'VARCHAR(64)', 
      'plate' => 'VARCHAR(8)',
      'chassis' => 'VARCHAR(32)',
      'license' => 'VARCHAR(32)',
      'hours' => 'MEDIUMINT',
      'mileage' => 'MEDIUMINT',
      'optionals' => 'TEXT',
      'address' => 'TEXT',
      'map' => 'TEXT',
      'created_at' => 'TIMESTAMP NOT NULL'
    ) );

    An example of my code (that not work) to retrieve the data into a single page template:

    
    $direct_sale = rwmb_meta( 'direct_sale', array( 
      'storage_type'    => 'custom_table', 
      'table'           => 'web_classified_meta'
    ));
    
    echo $direct_sale;
    
Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #12488
    Anh Tran
    Keymaster

    Hi Jefferson, the data types are MySQL types and listed here.

    I see the field direct_sale that you used has type TINYINT(1), so I guess it’s used for checkbox field, which has value 1 or 0.

    I’ve just checked the custom table extension and found a bug for displaying empty value (including 0). I’ll fix it now.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.