February 23
MySQL sql_mode - Get and Set sql_mode Settings to solve
Check your current sql_mode
SELECT @@GLOBAL.sql_mode;
or,
SELECT @@sql_mode;
Edit your my.cnf and remove "ONLY_FULL_GROUP_BY". if you don't have sql_mode, just add sql_mode to .conf. Restart mysql server.
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
...
March 11
MySql correct font display issue with asian font from DB by using UTF-8
Use set_charset to turn current charset to utf8, and you will be able to display Asian fonts.
$db_link = mysqli_connect($db['host'],$db['user'],$db['pass'],$db['db']);
// echo "Initial character set is: " . $db_link -> character_set_name();
$db_link -> set_charset("utf8"); // Change character set to utf8
// echo "Current character set is: " . $db_link -> character_set_name();
...
February 9
MySQL - Merge two user groups users into one current group, and delete the second group.
Merge two user groups users into one current group, and delete the second group.
Note: some users might be in both groups already.
# Show users in groupID 111 are also in groupID 222
SELECT user_id FROM user_group
WHERE user_group_id={111} AND user_id IN (SELECT user_id FROM user_group WHERE user_group_id={222} )
# Change user_group_id 222 to 111. Use 'UPDATE IGNORE' assume user_id & user_group_id are unique index
UPDATE IGNORE user_group SET user_group_id={111}
WHERE...