Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author bobbysmith007

    (@bobbysmith007)

    The plugin (by default) requires all tables to have an id_column specified which defaults to id. Perhaps this column is missing from the tables?

    Thread Starter clarkedesign

    (@clarkedesign)

    Perfect – fixed it right away

    Plugin Author bobbysmith007

    (@bobbysmith007)

    Glad this was resolved for you ??

    Hi, I have the same problem than clarckedesign. I have included in functions.php the code you provide in README:

    if(function_exists('add_db_table_editor')){
      add_db_table_editor('title=Employees&table=employees');
      add_db_table_editor(array(
        'title'=>'Event Registrations',
        'table'=>'event_registrations',
        'sql'=>'SELECT * FROM event_registrations ORDER BY date_entered DESC'
      ));
    }

    Does your answer mean that something related to id_column must be added to the previous code? What else?

    Thanks.

    Plugin Author bobbysmith007

    (@bobbysmith007)

    Do you have a column named ‘id’ in event_registrations? If not you need to specify a single column primary key (preferably an integer) in the ‘id_column’ parameter to add_db_table_editor.

    eg:


    add_db_table_editor(array(
    'title'=>'Event Registrations',
    'table'=>'event_registrations',
    'id_column'=>'er_id',
    'sql'=>'SELECT * FROM event_registrations ORDER BY date_entered DESC'
    ));

    Hi bobbysmith007,

    I have copied the new code you sent me in functions.php and still nothing appears in the DB Table Editor. I have not created an id column in Event Registrations by myself. Is such column created adding some other code to functions.php?

    Sorry if my question is very basic, but I really would like to understand the steps to start working with the plugin.

    Thanks again.

    Plugin Author bobbysmith007

    (@bobbysmith007)

    Usually db tables have some intrinsic id column. If it does not have an id column, something like the following command can add one. The plugin will not adjust table schema automatically.

    
    ALTER TABLE event_registrations ADD COLUMN id int PRIMARY KEY AUTO_INCREMENT;
    

    If you added an “id” column, simply remove this line: “‘id_column’=>’er_id’,” (which was looking for an id_column named “er_id”; “id” is the default name). Hopefully this will get you going.

    The basic idea is that we need an easy consistent way to track what rows we are editing and sending back and forth to the server.

    —-

    still nothing appears in the DB Table Editor

    If nothing is displaying you have a problem unrelated to id_column (which only allows editing). You can turn on wordpress debugging as it sounds like you might have an error in your sql or something.

    You can add the following line to the top of wp-config, but dont forget to remove it after you figure out your troubles.

    define( ‘WP_DEBUG’, true ); define( ‘WP_DEBUG_DISPLAY’, true );

    Hope this helps

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Unable to edit table – display fine but unetitable’ is closed to new replies.