Archive for the ‘PHP’ Category

Simple CRUD with PHP & MySQLi

It’s all well & good being able to get info from a database, but what you really want to do it add, edit and remove it. To save you tons of time looking for the code (like I did), here’s some snippets that should make life a lit easier when working with MySQL. I’m also going to...

Redirecting With PHP & htaccess

This blog used to be at the url http://pdwd.net/blog/. When I moved it over to it’s own sub-domain, I still got a few people going to the old domain looking for the blog, so I needed to redirect them. Here was my code. My .htaccess file looked like this: ErrorDocument 404 /404-redirect.php The 404-redirect.php file looked like this: <?php...

Saving Time With PHP Functions

The long repetitive process of coding the portfolio section of a website can get, well… repetitive. This is usually due to design decisions, like adding a class to latch onto, or setting the h4 tags to h3s. Each step has to be multiplied by the number of items you have in said portfolio. I was doing...

Style Current Nav Item When Including It

It’s quite common these days to include ( <?php include_once ("nav.html"); ?> ). It saves a lot of time when editing files and adding new pages but doing this looses the ability to give the current page a different style in the navigation. Here’s one way to get round this: Copy this code at the very...