Tag Archives: PHP

MySQLi

MySQLi is an improved version of the older PHP MySQL driver, offering various benefits.

The developers of the PHP programming language recommend using MySQLi when dealing with MySQL server versions 4.1.3 and newer

The MySQLi extension provides various benefits with respect to its predecessor, the most prominent of which  are:

  • An object-oriented interface
  • Object Mapping
  • Support for prepared statements
  • Support for multiple statements
  • Support for transactions
  • Enhanced debugging support
  • Embedded server support
  • More powerful Functionality

Differences Between Abstract Class And Interface

  • In abstract classes this is not necessary that every method should be abstract. But in interface every method is abstract.
  • Multiple and multilevel both type of inheritance is possible in interface. But single and multilevel inheritance is possible in abstract classes.
  • Method of php interface must be public only. Method in abstract class in php could be public or protected both.
  • In abstract class you can define as well as declare methods. But in interface you can only defined your methods.

phpMyAdmin

phpMyAdmin is a free and open source tool written in PHP intended to handle the administration of MySQL with the use of a web browser. It can perform various tasks such as creating, modifying or deleting databases, tables, fields or rows; executing SQL statements; or managing users and permissions.

Install phpmyadmin

1) Execute sudo apt-get install phpmyadmin
2) Edit the file /etc/apache2/apache2.conf. and include the line Include /etc/phpmyadmin/apache.conf
3) Restart Apache sudo /etc/init.d/apache2 reload

Features

  • Web interface
  • MySQL database management
  • Import data from CSV and SQL
  • Export data to various formats: CSV, SQL, XML, PDF (via the TCPDF library), ISO/IEC 26300 – OpenDocument Text and Spreadsheet, Word, Excel, LaTeX and others
  • Administering multiple servers
  • Creating PDF graphics of the database layout
  • Creating complex queries using Query-by-Example (QBE)
  • Searching globally in a database or a subset of it
  • Transforming stored data into any format using a set of predefined functions, like displaying BLOB-data as image or download-link
  • Live charts to monitor MySQL server activity like connections, processes, CPU/Memory usage, etc.
  • Working with different operating systems.

 

 

Magento Sessions

Customer sessions stores data related to customer, checkout session stores data related to quote and order. They are actuall under one session in an array. So firstname in customer/session will be $_SESSION[‘customer’][‘firstname’] and cart items count in checkout/session will be $_SESSION[‘checkout’][‘items_count’]. The reason Magento uses session types separately is because once the order gets placed, the checkout session data information should get flushed which can be easily done by just unsetting $_SESSION[‘checkout’] session variable. So that the session is not cleared, just session data containing checkout information is cleared and rest all the session types are still intact.

Magic Methods

The “magic” methods are ones with special names, starting with two underscores, which denote methods which will be triggered in response to particular PHP events. That might sound slightly automagical but actually it’s pretty straightforward, we already saw an example of this in the last post, where we used a constructor – so we’ll use this as our first example.

PHP functions that start with a double underscore – a “__” – are called magic functions (and/or methods) in PHP. They are functions that are always defined inside classes, and are not stand-alone (outside of classes) functions. The magic functions available in PHP are: __construct(), __destruct(), __call(), __callStatic(), __get(), __set(), __isset(), __unset(), __sleep(), __wakeup(), __toString(), __invoke(), __set_state(), __clone(), and __autoload().