htaccess 301 redirect non-www to www

To always redirect users to the www site (for example: http://dotboost.com to http://www.dotboost.com), add the following lines to .htaccess, right after RewriteEngine On: RewriteCond %{HTTP_HOST} ^dotboost.com [NC] RewriteRule ^(.*)$ http://www.dotboost.com/$1 [L,R=301] … Read More

How To Upgrade Wamp to PHP 5.3.4

1.    Stop WAMP server. 2.    Go to windows.php.net and download the the latests ZIPPED package for php5.3.4. Make sure it is the VC6 Thread Safe build. DO NOT DOWNLOAD THE INSTALLER. 3.  Create a folder php5.3.4 into wamp/bin/php … Read MoreRead More

Using LIKE wildcards with Zend_Db

Continuing the Zend_Db article series, let’s discuss the LIKE condition. The LIKE condition allows you to use wildcards in the WHERE clause of an SQL statement. This allows pattern matching. It can be used in any valid SQL statement (SELECT, … Read MoreRead More

Why use CURRENT_TIMESTAMP on a field that record date/time?

On a TIMESTAMP field that records date and time when inserting a new record, it is encouraged to use as a DEFAULT value, the CURRENT_TIMESTAMP constant. … Read More

Protection against SQL Injection using PDO and Zend Framework – part 2

Following the preview article about SQL Injection, here is more – a strong argument why you should use Zend Framework for handling database access. Zend_Db is the primary class used for access the database, but there is more: Zend_Db_Statement, Zend_Db_Select … Read MoreRead More

Protection against SQL Injection using PDO and Zend Framework

SQL injection is a technique that exploits a security vulnerability occurring in the database layer of an application. Usually, user input is not filtered by the script and is passed into a SQL statement. PDO – PHP Data Objects – … Read MoreRead More

INSERT, UPDATE, DELETE statements with Zend_Db

Continuing the Zend_DB article series, we are stopping now at DML statements. DML (Data Manipulation Language) statements are statements that change data values in database tables. There are 3 primary DML statements: INSERT – Inserting new rows into database tables. … Read MoreRead More

Subqueries with Zend_Db

Continuing the Zend_DB article series, we are stopping now at subqueries. As you note, the below is a complicate query, with COUNT(), LEFT JOIN(), GROUP BY – select from 3 tables, and make a count from 2 different tables: … Read More

What are returning the FETCH functions from Zend_Db

Continuing the Zend_DB article series, we are stopping now at FETCH methods that are in Zend_Db_Adapter_Abstract: array fetchAll (string|Zend_Db_Select $sql, [mixed $bind = array()], [mixed $fetchMode = null]) array fetchAssoc (string|Zend_Db_Select $sql, [mixed $bind = array()]) array fetchCol (string|Zend_Db_Select $sql, … Read MoreRead More

SQL queries using Zend_Db – SELECT

Zend_Db and its related classes provide a simple SQL database interface for Zend Framework. To connect to MySql database, we are using Pdo_Mysql adapter : $db = Zend_Db::factory(‘Pdo_Mysql’, $dbConnect); … Read More