Created
January 26, 2023 02:12
-
-
Save necmettin/7f523dcac8b67ca38f74f4640c2d1897 to your computer and use it in GitHub Desktop.
Revisions
-
necmettin created this gist
Jan 26, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ <?php function cmd_db_find_0000(): void { global $App; $key = "Tables_in_bulundum_com"; $tables = field2array($App->RDB->run("SHOW TABLES"), $key); foreach ($tables as $tablename) { $fields = $App->RDB->run("SHOW COLUMNS FROM `$tablename`"); foreach ($fields as $field) { if ($field['Type'] === 'datetime' || $field['Type'] === 'date') { $fieldname = $field['Field']; $qstr = "SELECT Id FROM `$tablename` WHERE $fieldname LIKE '0000%'"; $rows = field2array($App->RDB->run($qstr)); if ($rows) { pp("$tablename: $fieldname"); pp($qstr); ppj($rows); } } } } }