PHP: CRUD (Add, Edit, Delete, View) Application using OOP (Object Oriented Programming)

This article shows how to create a CRUD (Create, Read, Update, Delete) application system with PHP & MySQL using Object Oriented Programming (OOP) technique. I had written an article before about creating Simple CRUD application with PHP & MySQL but that has been programmed with procedural way. In this article, we create the same kind … Read more

Magento: Use MySQL functions with addExpressionAttributeToSelect

Function addExpressionAttributeToSelect as defined in Mage_Eav_Model_Entity_Collection_Abstract (/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php) allows us to use MySQL functions in Magento collection. Here is an example of using MySQL function CONCAT in Magento customer collection to concat customer’s firstname and lastname: $collection = Mage::getResourceModel('customer/customer_collection') ->addExpressionAttributeToSelect('fullname', 'CONCAT({{firstname}}, " ", {{lastname}})', array('firstname','lastname')); Here is another example which uses MySQL function MONTH which fetches … Read more

Ubuntu: Installing Apache, PHP, MySQL & phpMyAdmin

Here are step-by-step commands about installing apache, php, mysql, and phpmyadmin on ubuntu. 1) Open Terminal – Press: CTRL + ALT + T 2) Install Apache – In terminal, type: sudo apt-get install apache2 – To test if Apache installation, Open browser and type: http://localhost – It should show text: It Works! 3) Install PHP … Read more

Alter MySQL table to add & drop column & add Foreign Key

This article shows:- – How to add column to mysql database table after the table has already been created – How to delete column from mysql database table after the table has already been created – How to add foreign key to table column after the table has already been created Basically, all this can … Read more

Magento: Join, filter, select and sort attributes, fields and tables

In my previous article (Magento: Very Useful Collection Functions), I had written about database interaction functions present in class Varien_Data_Collection_Db. Here, I am going to explain some database interaction functions present in the class Mage_Eav_Model_Entity_Collection_Abstract. These collection functions are very useful to select data from Magento database. We need them almost all the time for … Read more

Magento: How to filter product collection using 2 or more category filters?

Suppose, you have a product collection and you want to filter it by category. Suppose, you want to filter it by more than one category. You can use addCategoryFilter if you have only one category. But, what if you want to filter by more than one category? Category ids are stored for product in a … Read more