Quantcast
Channel: Lil Josh » PHP
Browsing all 11 articles
Browse latest View live

Use PDO Not MySQLi

In NetTuts+ most recent tutorial, they discuss the advantages of using PDO over MySQLi to make database connections from PHP. “The core advantage of PDO over MySQLi is in its database driver support....

View Article



Image may be NSFW.
Clik here to view.

Facebook Page JSON & RSS Feed

Ever wanted to put a Facebook page’s feed into your website? Every Facebook page has an RSS & JSON feed. In this tutorial I will show you how to use PHP and JSON to pull the feed from Facebook...

View Article

Introduction to PHP PDO

CONNECTION //replace host, database, user, password $dbh = new PDO("mysql:host=mysql.host.com;dbname=DATABASE", 'USER', 'PASSWORD'); SELECT $stmt = $dbh->prepare("SELECT id, name FROM table");...

View Article

Swapping variables in PHP

I’ve created a short and sweet PHP function swap() to exchange/swap the values of two PHP variables. Here it is in action: <?php $cat = "cat"; $dog = "dog"; swap($cat,$dog); echo "$cat goes meow and...

View Article

timthumb and PHP thumbnails rotate with large images

I’ve been banging my head against the wall trying to figure out why large images were getting rotated when I made them into a thumbnail (either through timthumb or PHP’s imagejpeg). It turns out that...

View Article


Image may be NSFW.
Clik here to view.

Recursion in PHP

Using recursion can be a little hard to grasp if you are new to the concept. In it’s simplest form it’s a function that calls upon itself to create a loop. It is commonly used for traversing tree...

View Article

Texting with PHP

Ever needed to text someone through PHP? It’s very simple! Most cellular providers give an email address with your phone number that can be used to text that number. This is known as “email to SMS...

View Article

Remove .php extensions with .htaccess

You can clean up your URL a little by automatically removing the .php extensions and index files using mod_rewrite. This requires your web server has Apache running the mod_rewrite module. Create an...

View Article


Resizing High Resolution (Hi-res) JPEG Images with PHP

I kept running into a problem when I uploaded high resolution (14MP) images and tried creating thumbnails with them. The issue turned out being the PHP script ran out of memory. So it was a simple...

View Article


Combining Javascript Files to Reduce HTTP Requests

I just wanted a very basic PHP script to combine all my JS files into one – no minification, just bring them together into one file. <?php // compress the file using GZIP ob_start("ob_gzhandler");...

View Article

PHP namespaces and __autoload() for dummies (like me)

Using autoload and namespaces in PHP is for object-oriented programming. Autoload When building your classes and including them on pages that will use them, it can become tedious to have to write...

View Article
Browsing all 11 articles
Browse latest View live




Latest Images