Code

Here, you'll find chunks of PHP, MySQL, HTML, JavaScript, and Ajax code that we've put together while working through various projects. Hopefully they'll help you out in your coding adventures too.

How to Create a Symbolic Link in Windows Vista

Command Prompt | PHP | Windows | XAMPP
Quick step-by-step instructions explaining how to create shortcuts to another directory in your file system using mklink when using Windows Vista. » View Post

Shortening URLs in PHP with the bit.ly API

PHP
A quick, easy-to-use PHP function that takes your long URL's and converts them into something short and ready to post on Twitter, etc. Just plug in your bit.ly username and API Key and you're ready to go. » View Post

Convert an Entire MySQL Table to UTF-8

HTML | MySQL | PHP
A PHP function (with lots of comments) that converts a MySQL table and its data to UTF-8. It updates the collation of the table itself and of each text-based column. Additionally, it goes through each row and updates existing data automatically. » View Post

List of Latitudes and Longitudes for Every State

Data Dumps | Maps | MySQL
A list of the center latitude and longitude for all fifty of the United States (generated by taking the average latitude and longitude from each zip code within the state). In both HTML table and MySQL format. » View Post

Count Textarea Characters with JavaScript

HTML | JavaScript
Simple code that allows you to count how many characters have been typed into a textbox (or any other text element) and then displays the remaining amount of characters in a specified element. Works great for Twitter forms and the 140 character max. » View Post

Blog Ping List and XML-RPC Generator

Blogging | PHP | XML
An up-to-date list of blog ping endpoints. Also, a tool to construct your XML-RPC request to send to them. » View Post

Combining MySQL SUM and GROUP BY Clauses

MySQL
An experiment that shows how MySQL calculates a combination of SUM and GROUP BY clauses in the same query. » View Post

Block Crawlers from HTTPS with Robots.txt

.htaccess | PHP | robots.txt | SEO
If you allow search engine crawlers to index both HTTP and HTTPS versions of your site, you can run into some serious SEO issues. This quick guide explains how to stop that from happening with .htaccess, PHP, and robots.txt. » View Post

Convert Hex to Decimal Functions

CSS | HTML | PHP
The PHP functions you need to go from RGB values to a hexadecimal string and visa versa. » View Post

MySQL Vertical Display in HTML Table

HTML | MySQL | PHP
PHP code to display results from a MySQL query sorted vertically (rather than horizontally) in a table. Very simple and allows for custom number of columns. » View Post

Ajax Tutorial

Ajax | JavaScript | PHP
A simple crash course on Ajax that will get you started in a matter of minutes. Includes an easy to follow example with multiple Ajax calls from one page. » View Post

PHP MySQL Database Functions

Helpers | MySQL | PHP
The more I worked with MySQL and PHP, the more I realized that I was typing the same code over and over again. And, some of the functions I used most were really long and annoying to type. So, I created these functions as a shortcut. I include them in each file I write and they save a lot of time. » View Post

How to Pull a Twitter Feed Into Your Site Using PHP, MySQL, and the Twitter API

MySQL | PHP | Twitter
A quick tutorial on how to use the Twitter API to store your Tweets locally in a MySQL database and then display them on your website. » View Post

Custom Logging in PHP

PHP
A quick easy example of how to create a custom log using PHP. » View Post

Custom Sorting MySQL Data

MySQL
A quick tutorial explaining how to do custom sorts on your data from within the MySQL query, using the CASE statement. » View Post
Copyright © 2014, Ink Plant. All rights reserved.