PHP Data Object: How to

With reference to previous post on PDO. Here is a small tutorial and explanation for connecting to database using PDO object. I recommend using PDO as it is more structured way to connect to database rather than doing it by self plus the general functions like mysql_connect are to be deprecated in upcoming versions of… Continue reading PHP Data Object: How to

PDO: PHP Data Object

There are different ways of connecting to database in PHP. The most general way in use is MySQL extension, which we have discussed here and even everywhere. Well there are two other ways of connecting to database. First one is MySQLi and other is PDO. Now, question is what is the difference? So, the difference… Continue reading PDO: PHP Data Object

MySQL: Query Optimization Tips Part II

In previous post we dealt with the SELECT statement and WHERE clause optimization. In this post we will see optimization of INSERT statement. SELECT statement is very general for dynamic websites while INSERT is used very often where WRITE option is given. The tips for optimization of INSERT statement are: REPLACE can be used instead… Continue reading MySQL: Query Optimization Tips Part II

MySQL: Query Optimization Tips Part I

Writing SQL query is easy but it can use lots of server resources which is utmost important for huge databases, where minimization of execution delay is important, like Facebook – if they don’t update your status very frequently it will cost them users. Let’s start: Most important for query optimization is INDEX. Make sure you… Continue reading MySQL: Query Optimization Tips Part I

MySQL: Good Efficient Structured Database

MySQL is a well known name in RDBMS world and many of you must have used it. It implements one of the oldest way to create a database. I have never used it with any other application but web though. To run MySQL I use phpmyadmin, the browser application made for ease. We will be… Continue reading MySQL: Good Efficient Structured Database

Fetching from database using PHP

If you have database, then of course you will need to fetch data out of it. Four methods are described below to fetch from database and whats the difference between them. Required: PHP, MySQL. Using: SQL table PHP query: PHP fetch functions: Note: All parameters are not defined here but are explained below. Explanation: Methods… Continue reading Fetching from database using PHP

Comparing timestamp in MySQL

We often use timestamps in databases. In fact people often use it to make session keys. Comparing timestamp is also often required when detecting any change in database. That’s too much often. 😛 Required: MySQL Using: Table defination SQL query Explantion: This query selects id from table where jointime is greater than 2011-10-08. Note: Timestamp… Continue reading Comparing timestamp in MySQL