| Home | About Us | Web Hosting Plans & Pricing | Satisfied Customers | Support & Help | Contact Us |
| Active-Sites Support | ||||
|
MySQL Database access is where web site creation & development truly becomes useful. With databases, you can create a dymanic site & create pages with previously entered data. This allows you to cut down on your page creation time, much as has done with its own site. Active-Sites supports the mySQL database. You may access your database using the following methods. SSH or Web Page Script or Program Accessing your database from SSH First, login through SSH Use the following command: mysql -u[ Your User Name ] -p [ Your Database Name ] Enter your password when prompted. From this point, you can execute any SQL query, ended by a semicolon (;). You can find more information about sql from http://www.mysql.com, or from your local computer book store. Accessing your database from a web page script or program Your can access database from perl, c, c++, & python or PHP The following is a short example of accessing the database using a perl script: #!/usr/bin/perl use DBI; my $strDatabase = "[ Your Database Name ]"; my $strDataSource = "DBI:mysql:$strDatabase"; my $strUser = "[ Your User Name ]"; my $strPassword = "[ Your Password ]"; my $objConnection = DBI->connect ($strDataSource, $strUser, $strPassword) or print "Cannot connect to $strDatabase"; my $strSQL = "SELECT * FROM TABLE"; my $objRS = $objConnection->prepare ($strSQL); $objRS->execute or print "Cannot Execute"; if (my $objField = $objRS->fetchrow_hashref) { print "$objField->{fieldname}"; } $objRS->finish; $objConnection->disconnect; -------------------------------------- Make sure that you have created a database, table, and records, prior to using this script, and replace the names of the preceding, as well as the database name, username and password in their corresponding fields in the script. Of course, to develop a useful database-engined site, you need a lot more. Excellent documentation can be found at both www.mysql.com & www.webmonkey.com |
|||
| Copyright 2008 ® Active-Sites.com All Rights Reserved About Us | Terms Of Use Policy | Privacy Policy | Web Hosting Packages Contact Us |