Skip to main content

Posts

Connection between PHP (server) and Android (client)

Nowadays, PHP and Android are widely used platforms, while PHP is used for dynamic web development, Android is an OS for mobiles, tablets etc. To develop Android applications we can use the benefits of PHP to communicate it with MySQL database and get required data from there. We can use JSON and HTTP as an intermediate of communication between Android and PHP. The whole process can be divided into five steps: 1)       An HTTP request is sent from Android(Client) to PHP(Server). 2)       PHP runs it’s script to make connection with database, and send request to MySQL database for required data. 3)       MySQL responds back to PHP with requested data. 4)       PHP script analyse the date and coverts it into information. The whole information is then converted into JSON format and sent to the Android (Client). 5)       Android script reads ...

Overloading in PHP

PHP's interpretation of "overloading" is different than most object oriented languages. Overloading traditionally provides the ability to have multiple methods with the same name but different quantities and types of arguments. In PHP it's achieved through magic methods. Remember : 1) All overloading methods must be defined as public. 2) None of the arguments of these magic methods can be passed by reference. In PHP we have following two types of overloading and their respective functions. Property Overloading : Property overloading is achieved through __get(), __set(), __isset() and __unset() funtions. Property overloading only works in object context. These magic methods will not be triggered in static context. Therefore these methods should not be declared static. <?php require_once "DB.php"; class Persistable {        private $data = array();     private $table = "users";        public function __cons...

Explain ACID

The ACID model is one of the oldest and most important concepts of database theory. It sets forward four goals that every database management system must strive to achieve: atomicity, consistency, isolation and durability. No database that fails to meet any of these four goals can be considered reliable. Let’s take a moment to examine each one of these characteristics in detail: Atomicity : states that database modifications must follow an “all or nothing” rule. Each transaction is said to be “atomic.” If one part of the transaction fails, the entire transaction fails. It is critical that the database management system maintain the atomic nature of transactions in spite of any DBMS, operating system or hardware failure. Consistency : states that only valid data will be written to the database. If, for some reason, a transaction is executed that violates the database’s consistency rules, the entire transaction will be rolled back and the database will be restored to a s...

MySQL Basics

What Is MySQL : MySQL is a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server. It’s the most popular Open Source SQL database, provided by MySQL AB. MySQL AB is a commercial company that builds is business providing services around the MySQL database. mysql vs mysqli        :         mysqli is the object-oriented version of mysql library functions. Default Port             :        3306 Storage Engines      :        MyISAM, InnoDB, BDB(BerkeleyDB), MEMORY, CSV, BLACKHOLE  etc.. The following table describes the maximum length for each type of identifier. Identifier Maximum Length (characters) Database Name 64 Table Name 64 Column Nam...