Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I used options for my plugins.But now i have changed to use own table.i created and using things good.Now i would like to add one field that gets value from user and add that much value as field.This is like adding field dynamically.Example in options table i used the below

for ($i = 1; $i <= get_option('opt_count'); $i++) {
            register_setting('register_op', 'option' . $i);
        }

So if the user enter 3 in opt_count then i'll get 3 extra option by registering.Then i'll make use of the 3 fields. Same thing i want to do it in own table also.

    $sql = "CREATE TABLE $table_name (
    id mediumint(9) NOT NULL AUTO_INCREMENT,
    name VARCHAR(20) NOT NULL,
    message text NOT NULL,
    no_url VARCHAR(20) NOT NULL,
    UNIQUE KEY id (id)
     );";
    require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    dbDelta($sql);

Here when the user enter 3 in no_url option then i have to make 3 extra field where user can enter the 1st url in option one and 2nd url in option two going on..

How to do this.. I Think this is not easier as options method.Any idea will be helpful.

share|improve this question
    
Since you are out of realm of WP APIs really I think this boils down to figuring out table modification with SQL. Better asked at Stack Overflow. –  Rarst Sep 20 '13 at 13:16
    
Thanks.Can i ask the clone of this in SO? –  sun Sep 20 '13 at 13:18
    
I am not entirely sure if I understand question correctly. Are you talking about creating SQL table itself or creating values in existing table? –  Rarst Sep 20 '13 at 13:21
    
Creating a Column kind of thing in exsisting table.Like field to hold values.using one field value(4) i should be able to create 4 field in the same row. –  sun Sep 20 '13 at 13:25
    
Maybe this will help wordpress.stackexchange.com/questions/113319/… –  Waldermort Sep 20 '13 at 13:47
show 2 more comments

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.