Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Use XML to Build Services Cheaply Using PHP and MySQL : Page 2

Using the open source technologies of PHP and MySQL you can create server-side applications that abstract databases and return XML. Get all the flexibility of XML without laying out cash, and show your boss a cheap alternative to J2EE or .NET Web services in a runtime environment.


advertisement
Step 1. Download and Install MySQL and Set Up the Data
Download MySQL 4.0 production release, and extract the zip file to a new directory. Launch the file setup.exe to install it. Once the application is installed, reboot. If the server isn't running (check your task list for mysqld-nt.exe), you can run it from c:\mysql\bin.

Download MySQL Control Center (MySQLCC), extract the files, and run setup.exe. MySQL Control Center will install and place an icon on your desktop. Double click this icon to view the control center. On the left side of the screen you should see a list of MySQL servers. If the list is empty, right click the list and select "New." A dialog will appear. Set the "Name" to "ContentManager" and the "Host" to "Localhost."

Click "Add" and you will be returned to the previous screen. You should now see "ContentManager" on the list with a red button indicating that it has stopped. Right click "ContentManager" and select "Connect." The database will start and you will be connected to it. (In the next section, you will set up a table for the content manager.)



This solution builds a very simple database structure using the MySQLCC. You can easily extrapolate from these instructions to build applications of your own. If you have MySQLCC open and you are connected to the ContentManager database, open the ContentManager node to view the 'Databases,' 'Server Administration,' and 'User Administration' nodes.

Open the 'Databases' nodes to view the database available on this server. It will probably be populated with 'mysql' and 'test' databases.

Right click the 'Databases' node, and select 'Create New Database.'
Name the database 'Content' and click OK.
Right click the new 'Content' database and select 'Connect.'
Open the node, and select 'Tables.'
Right click 'Tables' and select 'New Table.'

Add the following fields in the Table manager:

FieldName

DataType

Size

TeamID

Int

11

TeamName

Varchar

100

TeamPlayed

Int

11

TeamWon

Int

11

TeamDrawn

Int

11

TeamLost

Int

11

TeamGF

Int

11

TeamGA

Int

11

TeamGAA

Int

11

TeamPts

Int

11

 

Select the TeamID field, and click the 'key' icon to make TeamID the key field for the table. Also, make sure that AUTO_INCREMENT is checked, and make sure that TeamID is added as an Index on the 'Indexes' tab. Save the table using the name 'Standings.'

You can now enter data on your table. Double click the table to access the table editor. If you prefer, some sample data is included in the download that comes with this article (see left column) as a CSV file. Check your MySQL documentation as to how to import the data from the MySQL command prompt.

Finally, you must give the root user (the default user set up by MySQL) a password. Double click the User administration node, and select root@localhost. Set the password to 'root' in the password box and click Apply. This step does not ensure a secure system. For a production system, you should set strong passwords for your database on a properly secured server.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap