This is a read-only copy of the MariaDB Knowledgebase generated on 2024-05-19. For the latest, interactive version please visit https://mariadb.com/kb/.

Comments - DELETE

1 month, 2 weeks ago Robert Lenoil

Tools like phpMyAdmin do not show the result set when using RETURNING, as they are not expecting both a numeric result (number of rows deleted) and a result set. PHP's mySQLi class similarly won't show the result set if you send the query with its query method; you need to use the multi_query method to send the query and then you'll be able to obtain the result set. For example:

$db->multi_query('DELETE FROM mytable WHERE status = 7 RETURNING *');
$result = $db->store_result();
$rowsDeleted = $db->affected_rows;
 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.