WPDB Update only the first row
-
I have this code, and I want to update only the first row found where the times column is equal to 0, but it updates all.
$dbHost = 'host'; $dbUser = 'user'; $dbPass = 'pass'; $dbName = 'name'; $mydb = new wpdb($dbUser,$dbPass,$dbName,$dbHost); $table_name = 'users'; $data = array( 'username' => 'name' ); $where = array( 'times' => 0 ); $format = array( '%s' ); $where_format = array( '%d' ); $mydb->update( $table_name, $data, $where, $format, $where_format );
How can I achieve this? Thanks.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘WPDB Update only the first row’ is closed to new replies.