Hi Everyone,

I am needing some help with a wordpress insert query.

I have this update query

    $qry ="UPDATE `".$wpdb->prefix."comments_real` SET  `comment_country` =  '$country',`comment_number` =  '$phone',`comment_smvcode` = '$ref' WHERE  `wp_comments`.`comment_ID` =$comment_id";

how do I change this to insert a new record in a db table called "comments_real"

Thanks in advance

Would this type of query work if I change 10, monkey, apple to
$country, $phone $ref... ?

$wpdb->query( $wpdb->prepare(  
    "INSERT INTO test_table (post_id, animal, food) VALUES ( %d, %s, %s )",  
    array(  
        10,  
        'monkey',  
        'apple'  
    )  
));
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.