0

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

1
Contributor
1
Reply
7
Views
3 Years
Discussion Span
Last Post by everton.retweets
0

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'  
    )  
));
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.