我制作了一个电子邮件脚本,只要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
") );
}
答案 0 :(得分:11)
试试这个:
$wpdb->update( $table_name, array( 'reminder' => 1),array('ID'=>$coupon_id));
答案 1 :(得分:5)
试试这个
UPDATE $table_name
SET reminer = 1
WHERE ID = $coupon_id
答案 2 :(得分:2)
您可以更改而不是(UPDATE * FROM)
$ereminders = $wpdb->query($wpdb->prepare("UPDATE $table_name SET reminer='1' WHERE ID=$coupon_id"));
并且不用休息。
谢谢。
答案 3 :(得分:1)
正在运作的矿井示例:
$result = $wpdb->update(
$wpdb->prefix .'sae_calendar',
array(
'year' => $year,
'quarter' => $quarter,
'start_date' => $start_date,
'end_date' => $end_date,
'reservation_start_date' => $reservation_start_date,
'reservation_end_date' => $reservation_end_date
),
array(
"id" => $id
)
);
答案 4 :(得分:0)
UPDATE $table_name
SET reminder = 1
WHERE ID = $coupon_id
另外,改变:
$coupon_id = $ereminder->ID;
到
$coupon_id = $ereminder->id;
答案 5 :(得分:0)
<?php
global $wpdb;
if(isset($_POST['progress'])){
$table=t_test;
$data=array('client_development'=>$_POST['Progress']);
$where=array('p_id'=>$_SESSION['id']);
$format=("%d");
$whereFormat=("%d");
$result4=$wpdb->UPDATE($table,$data,$where,$format,$whereFormat);
}
?>
<form method="post">
<input type="text" name="Progress">
<input type="submit" name="progress" value="Prog%">
</form>
<?php
if(isset($_POST['progress'])){
$table=t_test;
$data=array('client_development'=>$_POST['Progress']);
$where=array('p_id'=>$_SESSION['id']);
$format=("%d");
$whereFormat=("%d");
$result4=$wpdb->UPDATE($table,$data,$where,$format,$whereFormat);
}
?>
<form method="post">
<input type="text" name="Progress">
<input type="submit" name="progress" value="Prog%">
</form>
答案 6 :(得分:0)
我们可以这样使用$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);