I’ve created dynamic add/take away fields in a frontend publish submission web page. Utilizing $wpdb->insert, the system is working completely.
I’ve additionally created a draft edit web page on the frontend. On this web page I need these dynamic fields to get up to date. I attempted $wpdb->replace nevertheless it solely updates the final area. Briefly I need to replace a number of rows on single click on.
my code:
$project_id = $_SESSION['project_id'];
world $wpdb;
$reward_ids = $wpdb->get_results("SELECT * FROM wpxa_rewards WHERE project_id = $project_id");
foreach($reward_ids as $reward_id); $r_id = $reward_id->ID;
$depend = depend( $project_reward_title );
for ( $i = 0; $i < $depend; $i++ ) {
world $wpdb;
$wpdb->replace( 'wpxa_rewards',
array(
'reward_title' => "$project_reward_title[$i]",
'reward_description' => "$project_reward_description[$i]",
'reward_amount' => "$project_reward_amount[$i]",
'reward_shipping' => "$project_reward_shipping[$i]",
'est_date' => "$project_est_date[$i]"
),
array( 'ID' => $r_id ),
array(
'%s',
'%s',
'%d',
'%s',
'%s'
),
array( '%d' )
);
}
Plz assist.. Thanks