Sunday, October 25, 2009

Setup osCommerce on your server.

osCommerce is a free, open source online shop software. It is the most comprehensive and popular open source Shopping Cart system in existence.

This documentation is a starting for those who is new to osCommerce, and know PHP, and MySQL.

Requirement:

  • PHP
  • MySQL
  • Enabled Web Server

Installation:

1.
First of all download osCommerce from the link http://www.oscommerce.com/solutions and then unzip the folder, the folder contains -

  • catalog
  • catalog/admin
  • extras

2.
Upload the catalog folder to your document root using FTP/SFTP or any other method.

3. Using any MySQL tool create MySQL database and user, and assign that user
to the database. Write down the name of the database, user name, and password for this
database for the database installation.

4. Open your web browser and go to http://localhost/catalog/Install/ and click on the
Install button then you will get following window


then click continue.

5. Enter the database server information:

Database Server – localhost

The database server can be in the form of a hostname, or as an IP-address, such as 192.168.0.1.

Username – username

The username used to connect to the database server.

Password – password

The password is used together with the username, which forms the database user account.

Database Name – database name

Name of database used to store the data.

then click on continue.

6. Enter the web server information:

WWW Address - http://www.your-server.com/catalog/

The full website address to the online store

Webserver Root Directory - C:/wamp/www/catalog/

The server path to the online store
Click continue.

7. Online Storage Settings

Store Name : the name of the online store

Store Owner Name: name of the store owner that is presentedto the public

Email: Give the email-id where you want to the information.

Administrator UserName : Give the name which you want as an Administrator.

Administrator Password: Give the password what ever you want.
Click continue and you will reach the last step of installation.

8. This is last stage which shows that you osCommerece has ben setup. here you will get two option


Catalog : if you click on this then you will get the default setup of osCommerce Online Merchant.

Administration Tool: if you click on this then you will get the Admin page you have to login with your Administrator UserName and Password.

In admin panel you can play more and customize the application.

Sunday, July 12, 2009

Create XML file with PHP 5 and MySQL

In this tutorial i would like to explain that how to create XML files in PHP 5 after extracting data from the MySQL database.

In this code there is no hard coded node for the XML files , The data is retrived from the database as an associative and transformed to the XML files.

Requirement

There should be DOM extension available in PHP installation.

Code Sample

Let's discuss how many step is here to write this code, there are three step to write the code

(i) Connection from MySQL databse.
(ii) Retrieve data from the database tables.
(iii) Write retrieved data in XML files.

Connection from MySQL databse

$con=mysql_connect('localhost' , 'testuser' , 'pass123');

if( $con)
{
echo "could not connect host 'localhost' . ";
exit();
}
if (!mysql_select_db('demo'))
{
echo "Cannot connect to database 'demo' . ";
exit();

Above script connect with database 'demo' and now we can fetch the data from this database tables.

Retrieve data from the database tables

$query = "SELECT * FROM tablename ";
$result = mysql_query ($query , $con);

Now we have a data amd need to write it in XML format.

Write retrieved data in XML files

Create new XML document

$document= new DOMDocument( '1.0' );

The first element we create in the XML document is known as the root element. Each XML document must have 1 root element.

Create root node


$root
node = $document->createElement('root');
$rootnode = $document->appendChild($rootnode );

Now after creating the root node we have to add the data from the database


while($row = mysql_fetch_assoc($result))
{
$node= $document->createElementNS( 'Item', 'ezobject:object-relation-list' );
$node = $rootnode->appendChild($node);

foreach ($row as $fieldname => $fieldvalue)
{
$child =
$document->createElement($fieldname);
$child =
$node ->appendChild($child);

$nodevalue = $document->createTextNode($fieldvalue);
$nodevalue = $child->appendChild($nodevalue);
}
}
$xml_doc = $document->saveXML();

echo $xml_doc;


The above tutorial help you to create XML file in PHP 5.

Thursday, July 2, 2009

PHP and AJAX

In this article i would like to explain little bit about AJAX and how it works with PHP.

What is AJAX?

AJAX(Asynchronus JavaScript and XML) is based on JavaScript and HTTP Request.

With AJAX JavaScript can communicate directly with the server, with theXMLHttpRequestobject. With this object, a JavaScript can fetch data with a web server without reloading the page.

AJAX uses asynchronous data transfer (HTTP requests) between the browser and the web server, allowing web pages to request requried data(information) from the server instead of whole pages.

What is HTTP Request ?

HTTP (Hypertext Transfer Protocol) is a request/response protocol,Whenever web browser fetches a page (date) from a web server, it does so using HTTP. This means your web browser sends a request for some data and the web server sends back a response using the HTTP.

What is XMLHttpRequest ?

XMLHttpRequest is a JavaScript object that was designed by Microsoft,The XMLHttpRequest object provides a way to communicate with a server after a web page has loaded, it's support all the major browaer like Internet Explorer, Firefox, safari.

After explaining the above important terms let see how PHP works with the AJAX
PHP and AJAX :
working with PHP and Ajax is very simple

Step I: we need to know how to create an XMLHTTPRequest object. The process differs slightly depending on whether you are using Internet Explorer (5+) with ActiveX enabled, or a standards-compliant browser such as Mozilla Firefox.

With IE5 and IE6 , the request like:

http = new ActiveXObject("Microsoft.XMLHTTP");

With IE7+, Firefox, Chrome, Opera, Safari.we can instantiate the object directly like:

http = new XMLHttpRequest();

Step 2: We need to write an event handler which will be called via some event on our page, and will handle sending our request for data to our server.
The event handler will use various methods of our XMLHTTPRequest object to:

(i) make the request of the server
(ii) check when the server says that it has completed the request
(iii) deal with the information returned by the server

using above two step you can write PHP application using AJAX.

Friday, April 3, 2009

MySQL Event Scheduler

MySQL 5.1 Event Scheduler, Conceptually, this is similar to the idea of the UNIX crontab (also known as a cron job”) or the Windows Task Scheduler.

What is “Event Scheduler” event is an object whose statements are executed in response to the passage of a specified time interval. An event performs a specific action according to a schedule. An event’s timing can be either on-time or recurrent. A one-time event executes one time only. A recurrent event repeats its action at a regular time interval.

Events are executed by a special event scheduler thread; when we refer to the Event Scheduler, we actually refer to this thread. When running, the event scheduler thread and its current state can be seen by users having the PROCESS privilege in the output of SHOW PROCESSLIST

* MySQL 5.1.12 and later, an event are uniquely identified by its name and the schema to which it is assigned.

Let’s see how to create Event in MySQL 5.1:

Step I: You need in Install MySQL 5.1

Download MySQL 5.1 from URL http://dev.mysql.com/downloads/mysql/5.1.html#winx64 For windows

Follow simple Installer step according to Installation.doc;

Step II: Create database in MySQL Server.

I did the following necessary steps To Run the Scheduler:

(i) Goto Start>All programs>MySQL>MySQL 5.1 server> MySQL command Line Client

(ii) mysql> SET GLOBAL EVENT_SCHEDULER=ON;

(iii ) Create event writing simple statement on MySQL Command Line
mysql > CREATE EVENT purge_Data
ON SCHEDULE AT ‘2008-07-20 23: 59:00’
BEGIN
INSERT INTO archive_news_article select *from news_article where pubdate <>

and then press enter, Above event scheduler execute on ‘2008-07-20 23: 59:00’ only one time and purge data from news_article table to archive_news_article table. Let me Explain the recurrent event scheduler with an Example Let’s apply on same schema if we want to purge starts from a particular Date Time in every month end .

(iii) mysql> SET GLOBAL EVENT_SCHEDULER=ON;

(iii ) Create event writing simple statement on MySQL Command Line

mysql > CREATE EVENT purge_everymonth
ON SCHEDULE EVERY 1 MONTHSTARTS '2008-07-29 23:00:00' + interval 0 minute

DO
BEGIN
INSERT INTO archive_news_article select *from news_article where pubdate <>
END ;

and then press enter, Above event scheduler execute star t on ‘2008-07-20 23: 59:00’ and purge data from news_article table to archive_news_article table and then it execute every 1 month. At the 23: 59:00’ .

When a scheduled event is no longer wanted or needed, it can be deleted from the server by its definer using the DROP EVENT statement. Again go to Mysql command line:

Mysql> Drop Event purge_everymonth;

Important
It is possible to set the Event Scheduler to DISABLED only at server startup. If event_scheduler is ON or OFF, you cannot set it to DISABLED at runtime. Also, if the Event Scheduler is set to DISABLED at startup, you cannot change the value of event_scheduler at runtime.

For more details please visit http://dev.mysql.com/doc/refman/5.1/en/events.html

Happy Reading....:-)

Share/Save/Bookmark

Thursday, January 15, 2009

Windows (HTC 3400i ) PDA Phone in My Life .

It is my first windows mobile which i bought on 11-jan-2009. This phone gives me every thing which i want.





Before buying this mobile i was thinking i ll take a new mobile which have Internet browsing, Email Client POP3 SMTP, specially i was very crazy about touch screen but i had only budget of up to 10 k, keeping this thing in mind i bought this phone 9.5 k which gives me all the thing which i want and many more thing.

About HTC 3400i PDA Phone:

HTC 3400i mobile phone is powered by Windows Mobile 6 Professional with 64 MB RAM and includes many application that will allow you to internet browsing ,send emails, configure microsoft outlook , capture picture by 2 megapixel camera watch video and listen to music.


It include:

OS - Microsoft Windows Mobile 6.0 PocketPC

Others

-DirectPush Mail
-Internet Explorer Mobile
-Office Mobile (Excel Mobile, Powerpoint mobile, Word mobile)
-Windows Media Player 10 and Pictures and Videos
-Office-type utilities plus Windows Live Messenger
- External GPS
- Media Hub (Audio, Video, Pictures)
-
2 Megapixel camera

and this phone contains many more feature which make this mobile such as a pocket PC.

Lack in this Phone:

- In this phone no wi-fi , that is painfull for me.

-This phone is not 3G enable

still i am using it and writing on it....!!

Sunday, January 4, 2009

My first article in PC Quest Magazine India..!

"PC Quest online is the premier Indian computer magazine providing online computer news, IT articles from India and abroad and it's one of the best IT magazine in India"

I was reading this PC Quest magazine last 1(one) year, and i was also thinking to write something for PC Quest magazine so that people can read and implement my ideas so keeping this thing in mind i started writing article for PC Quest and my first article has been published in the Jan 2009 edition of PCQuest on page 106-107

Special Thanks to: Shekher Govindarajan who guide me a lot to write a such article on this technology, he is my Role Model in the feild of programming.

Now article is available in PC Quest Magazine and PC Quest website.

See here for more details :

Article Title: Create .Net Application in PHP.




Article Topic: The Phalanger plug-in lets you write .Net applications in PHP using Microsoft Visual Studio and run it on IIS web server on Windows.

In other word you can say that after Installing the Phalanger you can develop a web application as well as windows application in .NET framework using PHP as a language.



So you may read my article in PC Quest Magazine January 2009 print edition or you can read it any time anywhere on the PC Quest web site http://pcquest.ciol.com/ in .

Read and and start developing the .NET application in PHP by using Phalanger for more details please go through the step given in article

Happy reading :-)

....................
Pankaj Shukla

Tuesday, December 9, 2008

Firefox - 'Private Browsing'

Private Browsing is already a part of most of web browser like IE8, Google Chrome etc, The new beta for Firfox 3.1 Beta 2 has a feature for the private Browsing. it's a really good news for the Firfox lover.

A Private Browsing Mode allows you to browse without browser storing any traces of what and where you have Broswe!

Today(9-Dec-2008) i got a alert and saw this news that Firefox 3.1 Beta 2 is ready for download then i just open this given link http://www.mozilla.com/en-US/firefox/all-beta.html then i see it available for donload for the Windows, Mac OS, Linux, and i just download Firfox 3.1 Beta to for windows and Install on my windows machine. after Installing the browser i open the broswser and start searchig how i can make 'Private Browsing' i clicked the Tool tab an see the follwing




and then click on the 'Private Browsing' and the the tab open like this..

and then i started 'Private Browsing'.



The program title bar does state that you're using Private Browsing, but there's no blatant icon like other Browser. see below that only the title bar state that 'Private Browsing' there is no any icon on blatant icon.

Once you click on the Tool->Private browsing then my default browsing go to the 'Private Browsing'.
If you want to browse simple then you have to again go to the Tool->Private browsing and uncheck this then you will find the simple browser.

I am very happy to find 'Private Browsing' in Firefox .


You should also enjoy with Firefox -'Private Browsing' doing the simple excercise like download it from the above link and then Install it on your machine and then start browsing.

Happy Private Browsing with Firefox......!