據了解中國工信部早於去年就制訂了《互聯網域名管理辦法》,並於同年 3 月公開收集意見。官方表示有關政策主要是要去保護用戶合法權益,以及保障互聯網域名系統(DNS)的安全。在有關規例之下,但凡在中國境內進行網絡連接的域名都必須在中國註冊,並由國內的域名註冊管理機構運行管理:至於非境內註冊的域名,互聯網服務供應商將不得提供網絡接入服務。
woocommerce 以件數計算運費筆記
https://wordpress.org/plugins/woocommerce/
以件數計算運費
50 + (10+ [qty]) // 意思是最低收費為: 1件是50+10; 2件是50+20; 如此類推
[fee percent=”10″ min_fee=”50″ max_fee=”200″] // 運費是貨物的10%, 最低50, 最高200
MySQL import command
mysql -username -p -h localhost dbname < filename.sql
MySQL Command
https://gist.github.com/hofmannsven/9164408
Access monitor: mysql -u [username] -p; (will prompt for password)
Show all databases: show databases;
Access database: mysql -u [username] -p [database] (will prompt for password)
Create new database: create database [database];
Select database: use [database];
Determine what database is in use: select database();
Show all tables: show tables;
Show table structure: describe [table];
List all indexes on a table: show index from [table];
Create new table with columns: CREATE TABLE [table] ([column] VARCHAR(120), [another-column] DATETIME);
Adding a column: ALTER TABLE [table] ADD COLUMN [column] VARCHAR(120);
Adding a column with an unique, auto-incrementing ID: ALTER TABLE [table] ADD COLUMN [column] int NOT NULL AUTO_INCREMENT PRIMARY KEY;
Inserting a record: INSERT INTO [table] ([column], [column]) VALUES (‘[value]’, [value]’);
MySQL function for datetime input: NOW()
Selecting records: SELECT * FROM [table];
Explain records: EXPLAIN SELECT * FROM [table];
Selecting parts of records: SELECT [column], [another-column] FROM [table];
Counting records: SELECT COUNT([column]) FROM [table];
Counting and selecting grouped records: SELECT *, (SELECT COUNT([column]) FROM [table]) AS count FROM [table] GROUP BY [column];
Selecting specific records: SELECT * FROM [table] WHERE [column] = [value]; (Selectors: <, >, !=; combine multiple selectors with AND, OR)
Select records containing [value]: SELECT * FROM [table] WHERE [column] LIKE ‘%[value]%’;
Select records starting with [value]: SELECT * FROM [table] WHERE [column] LIKE ‘[value]%’;
Select records starting with val and ending with ue: SELECT * FROM [table] WHERE [column] LIKE ‘[val_ue]’;
Select a range: SELECT * FROM [table] WHERE [column] BETWEEN [value1] and [value2];
Select with custom order and only limit: SELECT * FROM [table] WHERE [column] ORDER BY [column] ASC LIMIT [value]; (Order: DESC, ASC)
Updating records: UPDATE [table] SET [column] = ‘[updated-value]’ WHERE [column] = [value];
Deleting records: DELETE FROM [table] WHERE [column] = [value];
Delete all records from a table (without dropping the table itself): DELETE FROM [table]; (This also resets the incrementing counter for auto generated columns like an id column.)
Delete all records in a table: truncate table [table];
Removing table columns: ALTER TABLE [table] DROP COLUMN [column];
Deleting tables: DROP TABLE [table];
Deleting databases: DROP DATABASE [database];
Custom column output names: SELECT [column] AS [custom-column] FROM [table];
Export a database dump (more info here): mysqldump -u [username] -p [database] > db_backup.sql
Use –lock-tables=false option for locked tables (more info here).
Import a database dump (more info here): mysql -u [username] -p -h localhost [database] < db_backup.sql
Logout: exit;
