Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

Wednesday, 16 May 2012

Import CSV file to a Database using PHP

A CSV file, as the name suggests, contains a list of values separated by comma. The end of each row is marked by a line break. This is one of the oldest file format used in computers and hence is supported in almost all operating systems. In this post, I will describe how to use a CSV file to populate a MySQL database.

INSERT IGNORE in MySQL

When you try to insert a new record in MySQL and the primary key specified in the insert query already exists, then an error will occur and the query will be aborted. Using the "IGNORE" keyword prevents errors from occurring. The records containing duplicate primary keys are ignored and the rest of the records are added. In the former case, no record will be inserted if such an error occurs.

Tuesday, 15 May 2012

Use PHP with MySQL

The main reason for many web developers to learn a scripting language like PHP is because of the ease with which it can interact with databases. In this post I will show you how to use PHP and the MySQL database to store information on the web and include it into your website. Before you read this tutorial you should have at least a basic knowledge of how to use PHP.

Wednesday, 9 May 2012

Create JSON from MySQL To use with AJAX

Now a days most websites use the power of AJAX to make their website more lively and productive. To transfer large amount of raw data, that JavaScript can process, the best way is to transfer it as a JSON file. It is quite easy for a PHP script to generate a JSON file from raw data. This data can be received using a suitable AJAX call. As JavaScript can easy parse JSON object, the rest of the processing with the received data can be done using JavaScript.

Thursday, 3 May 2012

Make a case sensitive MySQL Search

You might have noticed that when you search for a string in MySQL using '=' or 'LIKE' keyword, the search is not case sensitive. That is you will receive all records irrespective of the case (Uppercase or Lowercase). This is advantageous in several cases, but there are situations when you want the search to be case sensitive.

Monday, 16 April 2012

Database - Primary Key And Foreign Key

The primary key of a table uniquely identifies each row in a table. In a table, only one field can be assigned as a primary key. The primary key will be guaranteed as unique in the entire table, that is no two rows in a table will have the same primary key. The foreign key field of a table is used to match the primary key field of another table.

Saturday, 7 April 2012

MySQL tips for Better Performance

MySQL is one of the most popular database management system preferred by web developers around the world. The ease with which queries can be written and the seamless integration with various web scripting languages is the primary reason for this popularity. Most of the web programmers would have a hands on experience with MySQL. Complex database operations can be written quite efficiently with this open source database management system. This is true for low traffic web applications. But what happens when the traffic goes up? Will your applications perform well at high demands?