Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wpdb update query not working

I've made an email script that should update as soon as wp_mail has result. For some reason my value won't update. Have I missed something? I am receiving the mail so the wp_mail works.

Cheers!

$email_result = wp_mail( $to, $subject, $message, $headers );

if( $email_result ){//wp_mail() processed the request successfully
    global $wpdb;
    $table_name = $wpdb->prefix . "wpsc_coupon_codes";
    $coupon_id = $ereminder->ID;

$ereminders = $wpdb->query( $wpdb->prepare("
    UPDATE *
    FROM $table_name
    SET reminder = 1
    WHERE ID = $coupon_id
") );

}
like image 315
adnan Avatar asked Nov 27 '22 05:11

adnan


2 Answers

Try This:

$wpdb->update( $table_name, array( 'reminder' => 1),array('ID'=>$coupon_id));
like image 110
Luke Kalyan Brata Sarker Avatar answered Dec 06 '22 03:12

Luke Kalyan Brata Sarker


try this

UPDATE  $table_name
SET reminer = 1
WHERE ID = $coupon_id
like image 34
echo_Me Avatar answered Dec 06 '22 04:12

echo_Me