Let's Make A Website Together

I thought about a nice and simple project.. I will write a step by step tutorial on how to create a simple website. Why? Because I’m bored and don’t know what to do in my free time. I will show you how to design a simple layout with CSS and how to use PHP... 

How to str_replace in mysql

I recently bought a database with 170.000 entries, all of which had some stupid link at the end of one of their fields. Let’s say it was a cocktail recipes database and the links in the end were some advertisements like “if you want more recipes visit blahblah”. I... 

Format file sizes with PHP

A simple script that formats the number ob bytes of a file to kb, mb, gb or tb. function mksize($bytes) { if ($bytes < 1000 * 1024) return number_format($bytes / 1024, 2) . " KB"; elseif ($bytes < 1000 * 1048576) return number_format($bytes /... 

Email validation with PHP

This script is more accurate then a normal validation script. After checking if the email is correctly typed in (@) it checks the domain validity by checking it’s dns records (MX, A and CNAME). A piece of the regex is cut because of my sidebar but if you copy/paste... 

The best PHP IDE?

I used UltraEdit and then changed to Notepad++ but decided to start using something more specific for php. I found a site that reviews quite a lot of them, PHP editors review. I downloaded PHP Eclipse (you need Eclipse and then go to Help – Software updates –... 

Write less PHP code

I found a funny but working way to write less php and more html code.. Instead of writing: < ?php echo '< form action="" method="post">'; echo '< input type="text" name="something">'; echo... 

Get torrent data with PHP

To use this code you first need to include a file with the benc, bdec and hex2bin functions. You can get these functions from here: functions.phps. &lt;?php include 'functions.php'; $torrent_data = bdec(file_get_contents('yourfile.torrent')); To... 

Create an array for a tag cloud in PHP

Everyone tells us how to create a tag cloud with an array.. but how to actually create the array with the data that we fetch from our database? This is how I do it. The table we are working in is “pictures” and the field with the tags is “tags“.... 

How to update multiple mysql rows with PHP

Did you ever want to be able to update a dynamic number of rows in your mysql table and didn’t know how? For example: like on myspace when you edit your photo album, you have a gallery and you list one of your albums with x pictures in it. You want to be able... 

Next Entries »