Example code to update a single cell in a WordPress table that has three columns:
[php]
$wpdb->update(
wp_table,
array(
‘column3’ => $variable, // the column to update
),
array(
‘column1’ => 123, // the first WHERE argument
‘column2’ => ‘value2’, // additional WHERE argument!
),
array(‘%s’), // the format of the update value
array(
‘%d’, // the format of the first WHERE argument
‘%s’ // the format of the second WHERE argument
)
);
[/php]
Share/Ask