adn*_*nan 3 mysql wordpress wpdb sql-update
我已经制作了一个电子邮件脚本,只要wp_mail有结果就应该更新.出于某种原因,我的价值不会更新.我错过了什么吗?我收到邮件,所以wp_mail工作.
干杯!
$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
") );
}
Run Code Online (Sandbox Code Playgroud)
小智 12
试试这个:
$wpdb->update( $table_name, array( 'reminder' => 1),array('ID'=>$coupon_id));
Run Code Online (Sandbox Code Playgroud)
试试这个
UPDATE $table_name
SET reminer = 1
WHERE ID = $coupon_id
Run Code Online (Sandbox Code Playgroud)
小智 5
我们可以$wpdb->update这样使用:
global $wpdb;
$table_name = $wpdb->prefix.'your_table_name';
$data_update = array('row_name_1' => $row_data_1 ,'row_name_2' => $row_data_2);
$data_where = array('row_name' => $row_data);
$wpdb->update($table_name , $data_update, $data_where);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
38853 次 |
| 最近记录: |