To check if SELECT/UPDATE statement succeeded I use: if(!$select){ // SELECT failed } because MEDOO will return FALSE or 0 or empty Array if SELECT/UPDATE failed or no data were retrieved/updated, and all of these things are equal FALSE in an if statement. For INSERT you can use the same...
The UPDATE statement is used to update existing records in a table. And REPLACE method in the Medoo : The replacement value that replaces found search values in a record.
$delete = "123, 124, 125"; // original string $delete = explode(',',$delete); // convert to array foreach($delete as $id) { // walk wthrough array items $database->delete("users", [ // run medoo query "AND" => [ "id" => intval($id) // if whitespaces, make an integer ] ]); } ...
That could be an issue with requiring ANSI_QUOTES. MySQL has a non-standard setting by default, so you may need to change it. Normally MySQL uses both types of quotes to delimit strings and backticks for identifiers, whereas the SQL standard is to use double quotes for identifiers and single quotes...
The solution was easier than I expected, The query requires two joins for the foreign keys in the relation table. The table aliases are mandatory to prevent ambiguous column names. SELECT a_item_id, a_item.name AS a_item_name, b_item_id, b_item.name AS b_item_name, type_id FROM relation INNER JOIN item a_item ON a_item.item_id = a_item_id...
Answered on official Github ticket #195 https://github.com/catfan/Medoo/issues/195 If you are using medoo->select you can use count to check the size of the returned array: http://php.net/manual/en/function.count.php ...