Tag Archives: PHP

PHP validate email addresses

To rapidly, and decently, validate email addresses, we can use something like this: The filter_var() returns the filtered data or FALSE if it fails Read about it, and more filters, here: – function filter_var()

PHP error reporting – turning on or off

So you wrote this awesome php script, that does extreme stuff, but when you run it…it shows nothing. Empty browser. So whats going on? Well, for one, your php error reporting might be turned off by default. So how to turn it on? Read and learn. And forget tomorrow, like me.

Preventing SQL injection in PHP/MySQL with PDO

This is a bit old but i wanted to add it here so it stays on record. SQL injection is the action to inject SQL code in web forms to perform a site attack and disrupt its services. For a better definition, go read wikipedia here (it even has some code for you to test… Read More »

AMFPHP 1.9 problem with PHP 5.4

I was developing an application at work that used amfphp 1.9. All was working until i decided to bring it home to work over the weekend (thats already a bad thing to do right there), and i started getting errors. At work i use windows 7+xampp (with php 5.3.8), at home i use windows 8+xampp… Read More »

XAMPP PHP not working with PostgreSQL

This is a recurring problem i had. For some reason (which i later found out), i couldnt get my php scripts to connect to postgresql. The scripts borked at, for example, pg_connect() (unable to find the function, blah blah). First off, usually php doesnt come configured to run the postgresql dll out of the box… Read More »

Number formatting/padding before and after the decimal

Before i came up with this solution, i had some trouble formatting and padding decimal numbers, specifically when i want to do it before and after the decimal mark. To top it all, i wanted the result signed (with a plus sign(+) or minus sign(-) depending on the value of the variable) Example: I want… Read More »

First post / Primeiro post

This site will contain an archive of all the junk, problems, code snippets, tricks, hacks, solutions and garbage i want to keep to later use, reuse, alter, etc. Hopefully it will be of help to someone else. In portuguese: Este site conterá um arquivo de todas as tralhas, problemas, soluções e lixo que eu vou… Read More »