Articles tagged with: MySQL
This article shows how to create a CRUD (Create, Read, Update, Delete) application in PHP & MySQL using PHP Data Objects (PDO). PDO is a PHP extension that provides an interface for accessing databases in PHP.
PDO is portable and powerful. There are many good features of PDO. The best one is that it’s cross-database compatible. You don’t need to change your query function if you switch database server for your project. PDO extension supports different databases like MS SQL, MySQL, Oracle, PostgreSQL, SQLite, etc.
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 of CRUD application using OOP.
First of all, we will create a new MySQL database. Let us name the database as ‘test‘.
This article shows SQL query to get size (in MB) of all MySQL databases. It also shows the query to get the size (in MB) of all the tables present in any particular database.
Get size (in MB) of all MySQL databases
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:
Here are step-by-step commands about installing apache, php, mysql, and phpmyadmin on ubuntu.
1) Open Terminal
CTRL + ALT + T
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
Some definitions of foreign key:-
A FOREIGN KEY in one table points to a PRIMARY KEY in another table.
A foreign key is a field in a relational table that matches the primary key of another table. The foreign key can be used to cross-reference tables. A table may have multiple foreign keys, and each foreign key can have a different referenced table.
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 filtering collection object.
The JOIN keyword is used in an SQL statement to query data from two or more tables, based on a relationship between certain columns in these tables. [@via w3schools]
A SQL JOIN clause combines records from two or more tables in a database. It creates a set that can be saved as a table or used as is. A JOIN is a means for combining fields from two tables by using values common to each. ANSI standard SQL specifies four types of JOINs: INNER, OUTER, LEFT, and RIGHT. In special cases, …
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 comma separated way. So, to filter product collection by more than one category, you have to use:
You can add attribute from Admin Panel -> Catalog -> Attributes -> Manage Attributes.
You can also add attributes from mysql setup file of your module. MySql setup file is present inside “YourModule/sql/yourmodule_setup” directory.
Suppose, you have a module called MyModule. Its version is 0.1.0. Now, you want to do some database changes for the module. You have the mysql setup file (mysql install file) mysql4-install-0.1.0.php in MyModule/sql/mymodule_setup folder of your module.
You don’t need to make direct changes to database. You can upgrade your module to make your necessary database changes. To do so,
In this article, I will be presenting simple PHP & MySQL code to add, edit, delete and view data. This kind of system is also referred to CRUD (Create, Read, Update, Delete).
Here is a step-by-step guide on creating a CRUD system using PHP & MySQL:
In another article, I have written about Very Simple Add, Edit, Delete, View in PHP & MySQL. That article contains a basic CRUD (Create, Read, Update, Delete) system. It doesn’t have the feature of login and register.
In this article, I will be presenting a complete CRUD system containing login and register feature. User should register himself first. And then he can add data after logging in.