Import data from CSV file into a MySQL database

December 2, 2008

Few days ago, Client wanted to import a CSV file and all datas of this file will be inserted into a table in one project.For that, I implemented a class and contributed it in site as well.For this week,this class was top first downloaded the figure below.


And as a author rank of this week i was 5th. here attached the screen shot.


Class Name : fileImporter


This class can be used to import data from CSV file into a MySQL database.When any CSV or text file is imported by user,Firstly the file is uploaded a temp directory then the class open , read datas from this file and insert in a given MySQL database table.After then file will be deleted this temp directory. The class supports both tab and comma separated CSV files.

Download this class from here.Details example also explained there.

Please don’t  hesitate to knock me if you guys face any problem to install this class.


Easy Way Wiki Edit

October 10, 2008

1.What is greasemonky?
Greasemonkey is a Firefox extension that allows you to customize the way webpages look and function. Hundreds of scripts are already available for free. And if you’re the tinkerer sort, you can also write your own.
More details : to install greasemonky?

Go to the link below and click Ad to firefox button then it will be installed on your pc

3. What is wikEd?

A full-featured in-browser editor for Wikipedia and other MediaWikis.

wikEd is a full-featured text editor that adds enhanced text processing functions to Wikipedia and other MediaWiki wiki installations. wikEd is a complete rich-text pseudo-WYSIWYG editor and comes with many MediaWiki-specific features. For an extensive description check the wikEd homepage and the wikEd help page.

wikEd checks automatically for updates and opens the Greasemonkey popup to install a new version.
For quick tutorial go to install wikEd?

Its so easy to install wikEd.Click the below after then click on install enjoy:)

Simple Calculator

July 14, 2008

I implemented a simple calculator in my university life. I used JavaScript and html to implement this calculator. Today I have edited this. Using jquery I have built it draggable. By this calculator, simple all calculation can be calculated. Example: Add, Subtraction, Multiplication, Division, square root etc. The screen shot of this calculator are shown below….

Figure: Simple Calculator.

It’s too much easy and funny calculator. I think beginner might be helpful to learn JavaScript because here contains simple functionalities which will be more flexible to understand. see the demo here

Please click here to download this calculator.


[ NOTE : Its not for commercial use ]


RSS feed class

June 15, 2008

Today i have implemented a new class named RSS feed class.

Description of this class:

This class can be used to regenerate an RSS 2.0 feeds from another feed. It retrieves the contents from a given RSS feed and show it in the RSS 2.0 format. The regenerated feed is saved to an xml file.

Class Name : feedGenerator

Methods Description:

1. getHeader() : return the header of an xml file
2. getBody() : return the main contents of rss feed
3. getFooter() : return the footer of xml file
4. generateXMLFile() : Regenarated feed write on an xml file

Download this class from here

Used Technology :

Google Map API

May 10, 2008

It’s too much easy to integrate Google map in your site .For this, it is needed to be downloaded the GoogleMapAPI class from this link After then, Google Map API key is mandatory to create. You can register free here

I have implemented this script using smarty. Since I discussed installation technique of smarty in my previous post, so I used only two file named map.html and map.php. Now follow me
Step 1: Unzip the downloaded file. You need only GoogleMapAPI.class.php file
Step 2: Copy and paste the following code in map.html file

Step 3: Copy and paste the following code in map.php file

click on images to enlarge
If you would like to know details about this class,read the README file
Output of this script will like that:

Very Interesting…..isn’t it?

An Introduction to MVC

April 23, 2008

What is MVC?
A car is a good real-world example of MVC. With a car you have two views: the interior and the exterior. Both take input from the controller: the driver. The brakes, steering wheel and other controls represent the model: they take input from the controller (driver) and hand them off to the views (interior/exterior) for presentation.

MVC on the Web
MVC is an Object Oriented (OO) design pattern. A Model-View-Controller uses class to organize Business Logic contained in “Models”, Presentation Logic in “Views” and has an overall flow for the application within a “Controller”.

Figure 1:

The Model
Models are the portion of the MVC application that implements the “Business Logic”. Business logic is any PHP logic relating to how information is stored in your application.

The View
Views are the portion of the MVC application that presents output to the user. The most common output for PHP web applications would be HTML, but views are not restricted to this. Your MVC application might output XML, WML, plain text, images, email or some other content.

The Controller
The controller is the heart of the MVC application. The controller translate the mouse and keyboard inputs from the user, informing the model and/or the view to change as appropriate.

Figure 2:

Benefits and drawback of MVC details here.

TrygveReenskaug quoted about MVC as follows:
• The View is connected to the user’s eyes;
• the Controller is connected to the user’s hands;
• and the Model is connected to the user’s mind.


Smarty template engine

April 2, 2008

Smarty is a template engine for PHP. More specifically, it facilitates a manageable way to separate application logic and content from its presentation.
Benefits of using Smarty template engines:
1. separates code from HTML.
2. When you get used to using template engines, your applications will be developed faster
3. Your source code will be more organized, more clean and easier to understand
4. Teamwork is a lot easier.
Web page designers are not dealing with PHP code syntax, but instead easy-to-use templating syntax not much different than plain HTML. The templates are a very close representation of the final output, dramatically shortening the design cycle.

Code example

Since Smarty separates PHP from HTML, you have two files:

Follow the steps:
1.Download Latest Stable Release Smarty here
2. create two directory in www or htdoces named templates and temp
3. create a html file named test.html in templates dir
4. create a php file named test.php in root dir(i.e,www/htdocs)
step 2:
paste the following codes in test.html file

step 3:
paste the following codes in test.php file

Now browse test.php
output of this script will be…
This is the Smarty basic example.