| Welcome to my site! | |||||
|
Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables
Date function formatting | |||
| character | meaning | example | |
|---|---|---|---|
| Y | year as 4 digits | 2012 | |
| y | year as 2 digits | 12 | |
| n | month as 1 or 2 digits | 2 | |
| m | month as 2 digits | 02 | |
| F | month | February | |
| M | month as 3 letters | Feb | |
| j | day of the month as 1 or 2 digits | 4 | |
| d | day of the month as 2 digits | 04 | |
| l | day of the week | Saturday | |
| D | day of the week as 3 letters | Sat | |
| g | hour, 12-hour format as 1 or 2 digits | 4 | |
| G | hour, 24-hour format as 1 or 2 digits | 16 | |
| h | hour, 12-hour format as 2 diigits | 04 | |
| H | hour, 24-hour format as 2 digits | 16 | |
| i | minute | 26 | |
| a | am or pm | pm | |
| A | AM or PM | PM | |
| s | seconds | 02 | |
| date('l, F j, Y, g:i:s a') yields Saturday, February 4, 2012, 4:26:02 pm | |||
| date('Y_m_d') yields 2012_02_04 | |||
| date('Hi') yields 1626 | |||
Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables | |||
The getdate() array | |||
| key | value | example | |
| ['year'] | year | 2012 | |
| ['mon'] | month | 2 | |
| ['month'] | month name | February | |
| ['mday'] | day of the month | 4 | |
| ['weekday'] | day of the week | Saturday | |
| ['hours'] | hours | 16 | |
| ['minutes'] | minutes | 26 | |
| ['seconds'] | seconds | 2 | |
Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables | |||
Session configuration settings | |||
| setting | example | meaning | |
|---|---|---|---|
| session.auto_start | 0 | If sessions should be automatically used (0 means no). | |
| session.cookie_domain | www.acmenovelties.net | URL wherein the session cookie should be accedssible. | |
| session.cookie_lifetime | 0 | How long in seconds the session cookie should exist (0 means for the life of the browser). | |
| session.cookie_path | / | The domain path wherein the cookie should be accessible. | |
| session.cookie_secure | 0 | Whether or not the cookie must be sent over a secure connection (0 means no). | |
| session.gc_probability | 1 | The odds of performaning garbage collection from 1 to 100. | |
| session.gc_maxlifetime | 1440 | The time period in seeconds the session should last. | |
| session.name | PHPSESSID | The name given to all sessions. | |
| session.save_handler | files | How session data will be stored. | |
| session.save_path | /tmp | Where session data will be stored. | |
| session.serialize_handler | php | What method should be used to serialize the session variables. | |
| session.use_cookies | 1 | Whether or not teh session ID should be stored in a variable (0 means no). | |
| session.use_only_cookies | 0 | Whether or not teh session ID must be stored in a cookie (0 means no). | |
| session.use_trans_sid | 0 | Whether or not PHP should add the session ID to every link in an application. | |
Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables | |||
MySQL operators | |||
| operator | meaning | ||
|---|---|---|---|
| = | equals | ||
| < | less than | ||
| > | greater than | ||
| <= | less than or equal to | ||
| >= | greater than or equal to | ||
| != | not equal to | ||
| IS NOT NULL | has a value | ||
| IS NULL | does not have a value | ||
| BETWEEN | within a range | ||
| NOT BETWEEN | outside of a range | ||
| OR (also ||) | where one of two conditionals is true | ||
| AND (also &&) | where both conditionals are true | ||
| NOT (also !) | where the condition is not true | ||
Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables | |||
MySQL Text Functions | |||
| function | usage | purpose | |
| CONCAT() | CONCAT(x, y, ...) | Creates a new string of the form xy | |
| LENGTH() | LENGTH(column) | Returns the length of the value stored in the column. | |
| LEFT() | LEFT(column, x) | Returns the leftmost x characters from a column's value. | |
| RIGHT() | RIGHT(column, x) | Returns the rightmost x characters from a column's value. | |
| TRIM() | TRIM(column) | Trims excess spaces from the beginning and end of the stored value. | |
| UPPER() | UPPER(column) | Capitalizes the entire stored string. | |
| LOWER() | LOWER(column) | Turns the stored string into all lowercase. | |
| SUBSTRING() | SUBSTRING(column, start, length) | Returns length characters from column beginning with start (indexed from 0). | |
Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables | |||
MySQL Numeric Functions | |||
| function | usage | purpose | |
| ABS() | ABS(x) | Returns the absolute value of x. | |
| CEILING() | CEILING(x) | Returns the next-highest integer based upon the value of x. | |
| FLOOR() | FLOOR(x) | Returns the integer portion of x. | |
| FORMAT() | FORMAT(x, y) | Returns
x formatted as a number with y decimal places and commas inserted every three spaces. | |
| MOD() | MOD(x, y) | Returns
the remainder of dividing x by y (either or both can be a column). | |
| RAND() | RAND() | Returns a random number between 0 and 1.0. | |
| ROUND() | ROUND(x, y) | Returns the number x rounded to y decimal places. | |
| SIGN() | SIGN(x) | Returns
a value indicating whether a number is negative (-1), zero (0), or positive (+1); | |
| SQRT() | SQRT(x) | Calculates the square root of x. | |
Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables | |||
MySQL Date and Time Functions | |||
| function | usage | purpose | |
| HOUR() | HOUR(column) | Returns just the hour value of a stored date. | |
| MINUTE() | MINUTE(column) | Returns just the minute value of a stored date. | |
| SECOND() | SECOND(column) | Returns just the second value of a stored date. | |
| DAYNAME() | DAYNAME(column) | Returns the name of the day for a stored value. | |
| DAYOFMONTH() | DAYOFMONTH(column) | Returns just the numerical day value of a stored date. | |
| MONTHNAME() | MONTHNAME(column) | Returns the name of the month in a date value. | |
| MONTH() | MONTH(column) | Returns just the numericaal month value of a stored date. | |
| YEAR() | YEAR(column) | Returns just the year value of a stored date. | |
| ADDDATE() | ADDDATE(column, INTERVAL x type) | Returns the value of x units added to column. | |
| SUBDATE() | SUBDATE(column, INTERVAL x type) | Returns the value of x units subtracted from column. | |
| CURDATE() | CURDATE() | Returns the current date. | |
| CURTIME() | CURTIME() | Returns the current time. | |
| NOW() | NOW() | Returns the current date and time. | |
| UNIX_TIMESTAMP() | UNIX_TIMESTAMP(date) | Returns the number of seconds since the epoch or since the date specified. | |
| available types: SECOND, MINUTE, HOUR, DAY, MONTH, YEAR -and- MINUTE_SECOND, HOUR_MINUTE, DAY_HOUR, YEAR_MONTH | |||
Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables | |||
MySQL DATE_FORMAT() and (TIME_FORMAT() parameters | |||
| term | usage | example | |
| %e | Day of the month | 1 - 31 | |
| %d | Day of the month (2 digit) | 01 - 31 | |
| %D | Day with suffix | 1st - 31st | |
| %W | Weekday name | Sunday - Saturday | |
| %a | Abbreviated weekday name | Sun - Sat | |
| %c | Month number | 1 - 12 | |
| %m | Month number (2 digit) | 01 - 12 | |
| %M | Month name | January - December | |
| %b | Month name, abbreviated | Jan - Dec | |
| %Y | Year | 2006 | |
| %y | Year | 06 | |
| %l | Hour | 1 - 12 | |
| %h | Hour (2 digit) | 01 - 12 | |
| %k | Hour (24 hour clock) | 0 - 23 | |
| %H | Hour (24 hour, 2 digit) | 00 - 23 | |
| %i | Minutes | 00 - 59 | |
| %S | Seconds | 00 - 59 | |
| %r | Time | 8:17:02 PM | |
| %T | Time (24 hour clock) | 20:17:02 | |
| %p | AM or PM | AM or PM | |
Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables | |||
MySQL grouping functions | |||
| function | usage | purpose | |
| AVG() | AVG(column) | Returrns the average value of the column. | |
| MIN() | MIN(column) | Returns the smallest value in the column. | |
| MAX() | MAX(column) | Returns the largest value in the column. | |
| SUM() | SUM(column) | Returns the sum of all the values in the column. | |
| COUNT() | COUNT(column) | Counts the number of rows. | |
Top :: Date func format :: getdate() array :: Session config :: MySQL operators :: Text funcs :: Numeric funcs :: Date funcs :: DATE_FORMAT() :: Grouping :: Altering tables | |||
ALTER TABLE clauses | |||
| clause | usage | meaning | |
| ADD COLUMN | ALTER TABLE tablename ADD COLUMN column_name VARCHAR(40) | Adds a new column to the end of the table. | |
| CHANGE COLUMN | ALTER TABLE tablename CHANGE COLUMN cloumn_name column_name VARCHAR(60) | Allows you to change the data type and properties of a column. | |
| DROP COLUMN | ALTER TABLE tablename DROP COLUMN column_name | Removes a column from a table, including all of its data. | |
| ADD INDEX | ALTER TABLE tablename ADD INDEX indexname (column_name) | Adds a new index on column_name. | |
| DROP INDEX | ALTER TABLE tablename DROP INDEX indexnaame | Removes an existing index. | |
| RENAME AS | ALTER TABLE tablename RENAME AS new_tablename | Changes the name of a table. | |
|
© 2006 Robert Scott Truesdell and Acme Novelties
|