wordpress wpdb->update not working

落花浮王杯 提交于 2019-12-11 03:31:14

问题


I can't update with wpdb->update

here is my code :

$tweet = $_POST['tweet'];
$id = $_POST['id'];
$wpdb->update( $table_name, array('id' => $id , 'tweet' => $tweet ), array( 'id' => $id ),array("%d","%s"), array("%d") );

Nothing wrong i think , but i can't update

thanks advanced


回答1:


$data_update = array('title' => $title ,'parent_id' => $parent_id);
$data_where = array('id' => $id);
$wpdb->update($table_name , $data_update, $data_where);

Simple & working ;)



来源:https://stackoverflow.com/questions/11350886/wordpress-wpdb-update-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!