Making It Your Web

PHP and MySQL Tutorial (Updated)

by Alex Hall (on 17th Jul 2013 @ 12:49:40)

  • 0 paragraph notes

Quite a while ago now I posted a blog about how to interact with a database to save the star ratings from my Star Rating Script built with YUI. I recommend you do not follow the guidelines in that post any more because it uses an old method of database interaction with PHPs built-in mysql_* functions, which are really not secure any more and deprecated in the newest version of PHP.

What you should be using for database interactions from PHP these days is what is known as PDO, which stands for PHP Data Objects. From the PHP website:

The PHP Data Objects (database-specific PDO driver to access a database server.

PDO provides a data-access abstraction layer, which means that, regardless of which database you're using, you use the same functions to issue queries and fetch data. PDO does not provide a database abstraction; it doesn't rewrite SQL or emulate missing features. You should use a full-blown abstraction layer if you need that facility.

read post

I Love Responsive Design

by Alex Hall (on 13th Mar 2013 @ 16:42:08)

  • 0 paragraph notes

I should probably be a little more specific. I love writing the CSS that produces a responsive website. I've been reading up on responsive design since it's inception and then popularity. And why wouldn't it be popular? A massive percentage of browsing these days is done on the ever faster and better mobiles. Responsive design takes the middle-ground between a website built for the desktop, and an app built for the phone. It covers both with beauty and simplicity!

Of course, when I say simplicity I mean it's simple when you know how. But the fundamentals to create a responsive website are pretty basic thanks to CSS media queries, and the plethora of responsive toolkits you can find on the web today (Bootstrap, Foundation, Skeleton to name but a few). In fact, if you want to go ahead and don't want to do it yourself, dropping any of these into your site (with a few tweaks) will see you all responsive in no time!

read post

How To Use The Twitter API

by Alex Hall (on 17th Aug 2009 @ 15:28:15)

  • 0 paragraph notes

How To Use The Twitter API

There are a few examples on the web about using the Twitter API, but I've noticed that more and more often they refer to using exec() commands in PHP which a lot of web hosts deny to their users automatically. This makes using the API a little tricky as the only other good method for using the service is with cURL.

cURL is a PHP library written by Daniel Stenberg, that allows you to connect and communicate to many different types of servers with many different types of protocols. This means you can use it from your web server to request documents from another web server and do all sorts of things with the response.

The Twitter API supports cURL requests and the easiest way to use these requests will be shown just below. It is also worth checking the Twitter API Documentation, which contains all of the functions they support as well as plenty of information on the sorts of things you can pass to the feed, and the response you will receive.

read post