• lavishcreative

    (@lavishcreative)


    I have a whole load of values (strings and integers mixed) that I need to insert into separate columns in my database. This is what I have so far:

    $keys = "column1, column2, column3, column4,... and so on";
    $values = "value1, value2, value3, value4... and so on";
    
    $wpdb->query($wpdb->prepare("INSERT INTO tablename ($keys) VALUES ($values))";

    Is this possible, or do I have to create a separate variable for each value and declare each as a ‘%d’ or a ‘%s’ ??

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘simple syntax question: wpdb->prepare()’ is closed to new replies.