MySQL Lead-In Sentence fragment...
14
Display contents of a folder, see comments in code.
7
Generate multi select box from data in db, then when submitted, each selection is written to a db table as it's own record, each tied together by a common record id.
-6
Get the count of records from DB
12
With this function you can calculate the age of a person
Example:
echo "Age is: " . age("1984-07-05");
Result will be (23 Feb 2005) = "Age is: 20"
Example:
echo "Age is: " . age("1984-07-05");
Result will be (23 Feb 2005) = "Age is: 20"
7
Using the extract() Functio
-7
I use this method for keeping my sql templates away from my code.
You can extend upon the idea, as I have done in the past, by placing SQL handing classes between your scripts and the template library.
Things to note here:
The lesser userd heredoc string method. The reason this is used is to keep the SQL clear and well laid out, and not as messy as using quotes.
vsprintf() is a very handy function if you don't want to hard code the number of parameters to interpolate your string with.
The use of sprintf templates offers you additional security. For example, only allowing numbers to be placed where a %d falls. This, of course, shouldn't be the only security on user supplied variables, but comes in extra handy for debugging purposes.
Regarding the TODO in there, it would take a check of the number of % placeholders there are in the template. One caveat is remembering to remove the count of %%'s that appear (the literal percentage).
You can extend upon the idea, as I have done in the past, by placing SQL handing classes between your scripts and the template library.
Things to note here:
The lesser userd heredoc string method. The reason this is used is to keep the SQL clear and well laid out, and not as messy as using quotes.
vsprintf() is a very handy function if you don't want to hard code the number of parameters to interpolate your string with.
The use of sprintf templates offers you additional security. For example, only allowing numbers to be placed where a %d falls. This, of course, shouldn't be the only security on user supplied variables, but comes in extra handy for debugging purposes.
Regarding the TODO in there, it would take a check of the number of % placeholders there are in the template. One caveat is remembering to remove the count of %%'s that appear (the literal percentage).
15
A small recursive php function to determine the size of a directory by adding all it's contents together and returning them as an integer.
8
Truncate String
14
Get File Extensio
9
Get File Size









