5
This is a cool function that lets you save MySQL query data to an Excel spreadsheet. This is good for taking a backup or if you want to change a lot of information fast, then re-upload it.
I will use the config.php and class.mysql.php files from MySQL DB Class with Extras, so please look at those also.
I will use the config.php and class.mysql.php files from MySQL DB Class with Extras, so please look at those also.
5
Well after searching the internet for something similar to this, I didn't come up with anything...so I made my own! This simple script will track your members' time spent on your website. Please feel free to give comments/suggestions/feedback.
10
Here is a pair of function to use in combination. The first one will change newlines into tags to store into a database. The second one does the reverse so you can edit the content of the database without having the tags show when you edit the content. If you can find improvements or have comments please let me know
2
My previous entry on an easy to use SQLite interface for XUL/JS got me thinking: how many times have I had to write functions that were just wrappers for a little SQL?
Below is the fruits of that little query (excuse the pun). Forgive the dbXXX functions; my implementation depended on a small portion of a larger mysql library that I've grown accustomed to coding with.
Below is the fruits of that little query (excuse the pun). Forgive the dbXXX functions; my implementation depended on a small portion of a larger mysql library that I've grown accustomed to coding with.
13
Pagination Class , I think everyone knew now what's it does and means
NT: This class written by my friend have phun!
NT: This class written by my friend have phun!
24
"Today in the news, MySQL previews..."
As a "preview" of text, this MySQL select will return the first few words out of a text field in a database. It returns entire words (doesn't cut them off in the middle) and follows the last word with an elipse "..."
In the PHP, assign $CharactersToDisplay to a number - the approximate number of characters desired (or you can hard-code it if you want).
For the example, I also use $TheID as the row identity for the record to display.
As a "preview" of text, this MySQL select will return the first few words out of a text field in a database. It returns entire words (doesn't cut them off in the middle) and follows the last word with an elipse "..."
In the PHP, assign $CharactersToDisplay to a number - the approximate number of characters desired (or you can hard-code it if you want).
For the example, I also use $TheID as the row identity for the record to display.
14
MySQL 5.x Stored Routines, PHP Session Values, a little CSS oh my! Complex to set up but easy to impliment. Geared toward security, simplicity (of use) and convenience.
2
When you need to perform an action on a single row of data, many people turn to cursors. Cursors come with a lot of overhead in the database engine and can be confusing. Here's a way to get the same results without the overhead in a much simplier way.
0
this snippet show how to set up passwords in a mysql console.
-8
This class is a simple authentication scheme which makes it easy to add authentication to any page by including one class and adding one table to your MySQL database.
The following functions are employed by this authentication class:
auth()
is_authorized()
mysql_bind()
user_create($username,$email,$password)
user_activation_message($username)
user_activation($activation_hash)
user_password_change($username,$password_old,$password_new)
user_logout()
is_username_available( $username )
The following functions are employed by this authentication class:
auth()
this is the default constructor; it automatically checks for the POST vars "username" and "password", it also checks to see if the user passed the GET variable "logout", which would prompt it to set the authentication status to un-authenticated.
is_authorized()
Checks the SESSION variable "authorized" and returns true or false depending on that variable.
mysql_bind()
This is automatically called by the constructor each time the class is instantiated and $_POST['username'] and $_POST['password'] are present. It queries the db for a valid username and MD5 encoded password.
user_create($username,$email,$password)
Creates a user, if the username is available, and creates an MD5 hash based on username, password and date, to be used in the "activation" of the account.
user_activation_message($username)
Sends the custom activation message to the email address for the username specified
user_activation($activation_hash)
Checks to see if the activation hash is valid, if it is, the activation_hash variable is set to NULL, thus signifying that the account is active.
user_password_change($username,$password_old,$password_new)
Quick and easy way to change the user's password with one function call.
user_logout()
Sets the authorization status in $_SESSION['authorized'] to FALSE
is_username_available( $username )
Returns TRUE or FALSE depending on whether or not the username is free.









