Answer the question
In order to leave comments, you need to log in
How to update records in a table in a wordpress loop?
Good afternoon. Need help with loop, can't figure out how to update records in wp table.
I am getting data from a table. In this manner
$t_name = $wpdb->prefix . 'buy_';
$query = $wpdb->get_results("SELECT id,cours,perc FROM ".$t_name." WHERE perc_on='yes'");
$var = '';
foreach ($query as $q ):
$var .= $q->perc;
$id .=$q->id;
endforeach;
$update = $wpdb->update(''.$t_name.'',array('cours'=>$course*$var),array('id'=>$id]));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question