Blogs

Error message

Deprecated function: Function create_function() is deprecated in GeSHi->_optimize_regexp_list_tokens_to_string() (line 4698 of /home/digipiph/public_html/sites/all/libraries/geshi/geshi.php).

Simple PHP CSV Class

Throughout my years in programming I've dealt a lot with reading and importing CSV files, exporting queries into CSV files, and building dynamic CSV files. I decided it was time to create a simple PHP class to do all this work for me.

With this class you can change the terminator, separator, enclosed, and escaped characters as well as mime type. You decide the file name and there are simple built in functions to let you easily navigate the rows and columns of the CSV.

The class is compatible with newer AND older (less than 5.3.0) versions of PHP.

jQuery each function, continue or break

A problem I run into all the time is how to use the equivalent of PHP's "continue" function with jQuery's "each" function. So I guess it is time to document it.

We can break jQuery's $.each() loop at a particular iteration by making the callback function return "false". If we return "true", it is the same as a continue statement in a for loop; it will skip immediately to the next iteration.

For example:

Sorting Arrays by Sub Array Values using PHP

Multidimensional arrays are very handy for storing lots of data in one array variable opposed to creating and having to manage many individual array variables. For example, let's say we need to store all of our employee's data. Instead of creating many different arrays, one for each employee, we can simply create a multidimensional array, and store all of the employee's data within that.

Multidimensional Array that we will sort

Getting Radio Button Values using jQuery and Javascript

There are many different ways to get the values of checkboxes using javascript or jQuery. I have assembled a list of some of the most popular methods.

Getting Radio Value using Name Attribute and jQuery

This method uses jQuery to select the DOM object via the name and property selector.

Killing MySQL Queries that exceed a timeout using PDO and PHP

Here is an easy way to kill queries using PDO connection method with MySQL. Note that you can NOT kill queries using a "prepared" string. It must be done using "query".

The first step is to grab the PROCESSLIST.

PDO Connection Basics and Examples using PHP

Here are some PDO connection method basics with examples.

You will often commonly see the connection method being referred to as $dbh and $sth. These simply stand for "database handler" and "statement handler".

Connecting to MySQL with PDO Object

Simple PHP Class used for uploading files and images

I wrote a simple PHP class that may be used for uploading and deleting files or images. This code allows the programmer to set the destination, file name, required extension, and max file size. The PHP class checks the file validation with its own internal functions and stores the errors or will automatically print the errors on screen if that is how you want them handled.

PHP Simple File Manager

Submitting multipart/form-data using jQuery and Ajax

It is possible to submit files using "multipart/form-data" and ajax. There are many sites out there that show complicated ways of doing this when it is really easy. It simply requires a little configuration of the jquery ajax process and grabbing your form data using the FormData() function.

Using the following method, you can submit multiple files and are not just limited to one.

Lets take a look at our form.

Return only the difference from MySQL results

The below example shows how to return the difference in tables from a MySQL query

Problem: A user has the ability to assign labels to records. When a user is to add a new label to a record only query the labels the user has access to and don't display the labels already assigned.

Building a Dynamic or Adding to a Javascript Namespace

Here is a quick example at how to build to an existing javascript name space. It is also used at building dynamic namespaces.

Pages

Subscribe to RSS - blogs