February 3rd, 2010
While I was working on a project, I developed a small module, which involves in currency conversion. The client needs to update the current currency rate automatically.
For example, by today the conversion rate for 1 USD in Indian Rupees is 46.14 . By tomorrow, It may change to 47 or even 49. The client needs to update the conversion rate automatically.
Read the rest of this entry »
Tags: currency conversion, php conversion rate, usd in inr, usd to gbp using php
Posted in PHP | 4 Comments »
January 22nd, 2010
So, you are creating a video site..huh? the users may upload videos more than 2 mb (which is the default limit pre-determined in php). how can you increase the upload file size?
This can be achieved by two files
1. php.ini
2. htaccess
Let me explain both the methods.
Read the rest of this entry »
Tags: htaccess, increase file upload limit, php.ini
Posted in Apache, PHP | No Comments »
January 20th, 2010
How to find the user’s ip address, who visited your site. Popularly known as visitor count. Let’s start building a visitor counter.
Create a table named ‘visits’ with following fields
VisitorID
VisitorIP
VisitDate
VisitPage
CREATE TABLE `visit`
(
`visitorID` INT
( 10
) NOT
NULL AUTO_INCREMENT
,
`visitorIP` CHAR
( 200
) NOT
NULL ,
`visitDate`
DATE NOT
NULL ,
`visitURL` VARCHAR
( 200
) NOT
NULL ,
PRIMARY
KEY ( `visitorID`
) ,
UNIQUE
(
`visitorID`
)
Read the rest of this entry »
Tags: build your visitor count, track users, track website visitors, user visit
Posted in MySQL, PHP | 1 Comment »
January 19th, 2010
How can I change the time zone? A simple solution is to modify the value in the php.ini file.
Open the php.ini file. If you don’t know, where the php.ini file is placed, try using phpinfo file.
Read the rest of this entry »
Tags: change timezone, php.ini
Posted in PHP | No Comments »
January 11th, 2010
So, you are running a website. More users are coming day by day. On a fine day, one of your customer reports you an error in your site. You don’t have any idea, what he is talking about. You don’t know, when the error occurred. You are checking you apache log file. You are checking thousands and thousands of lines in the log file. But you don’t understand on how to re-create the error scenario to fix it. Felt so bad, about your code. Now , let’s involve some file concepts to fix this.
The basic thing, what you missed in your code is, in case of any error, you forget to catch the error and store it in a file.
Let me show me an example.
Read the rest of this entry »
Tags: create your error log, error log, php error code, write error log
Posted in PHP | No Comments »
January 9th, 2010
I hope you liked my previous tutorial. I am sure, you understood, how to store images in MySQL database using PHP. If you haven’t gone through the previous post, Here’s the link. Link to my previous post
Now, we are going to display the image, stored in the MySQL database.
Read the rest of this entry »
Tags: display image using php, display images from mysql, retrieve stored image from mysql using php
Posted in MySQL, PHP | 2 Comments »
January 8th, 2010
Storing images in a database is quite a simple process, as storing in folders. I prefer to store images in folders rather than in database. In some cases, you may need to store images in database.
Let’s see how to store images in database.
Database
To store images in the database, Large BLOB is a suitable format , provided in mysql.
Creating a table
CREATE TABLE `images`
(
`imageID` INT
( 10
) NOT
NULL AUTO_INCREMENT
,
`imageData` LONGBLOB NOT
NULL ,
PRIMARY
KEY ( `imageID`
)
)
Read the rest of this entry »
Tags: blob datatype, file upload, handle file uploads, store images in database
Posted in MySQL, PHP | 6 Comments »
January 7th, 2010
What do you think about this URL?
www.phpdevteam.com/nastyurl/category=12&subcat=3&id=2
Nasty? Yes. Most search engines too find it very difficult to include this in their database.
Now look at this URL.
www.phpdevteam.com/product/laptop/12/lenovo/3/id/2
Is it nice?
Now, let me explain you the programming part, to achieve this URL format.
Read the rest of this entry »
Tags: htaccess, PHP, search engine friendly url, url format, user friendly url
Posted in Apache, PHP | No Comments »
January 6th, 2010
I have been playing with JQuery for the past few days. After getting tired of writing lines and lines of code in javascript, Jquery does the same functionality with a couple of lines.
Let’s see a small comparison between a javascript code and JQuery.
Task: To show and hide a div tag with contents in it.
Most web developers come across this situation to show and hide the div contents – Let’s simply say it as toggle div tags
Read the rest of this entry »
Tags: javascript show hide, jquery show hide, show hide div tags, toggle div tags
Posted in JQuery, Javascript | No Comments »