A brief tutorial on connecting PHP and MySQL

May 18th, 2010 | Posted under Software, Web Design Tutorials | No Comments »

A brief tutorial on connecting PHP and MySQL

The need to interact with your target customers has prompted websites to undergo a major evolution. Now, web admins try to collect as much data as possible from the visitors of their site for better communication. Therefore, a number of tools and applications have been developed which connects the website (what visitors see) and the back end database (where user data is stored). The combination of PHP-MySQL is one such application that is simple and extremely easy to implement.

Here, we will go through the basic steps of connecting the PHP script to the MySQL database

Mention the configuration details

Three important parameters must be mentioned in form of PHP variables for use at multiple places

a. The host name of the MySQL server (generally localhost)
b. User name of the server
c. Password (if any)

Connecting to MySQL

The connection happens after the following line is executed:

$connection = mysql_connect (hostname, username, password) or die (“Some error”);

Selecting the database

Once connected to the MySQL server, the concerned database has to be chosen using the following script:

mysql_select_db(database name);

Once this is done, other SQL functions can be easily used and the results would reflect on the connected database.

BounceWeb has great plans for PHP-MySQL hosting!

New features in MySQL 6

July 25th, 2009 | Posted under The Internet, Web Design Tutorials, Web Hosting, Web Hosting Tips | No Comments »

New features in MySQL 6

Hi all,

For normal users, identifying with MySQL is not very common. A HTML file or even a PHP file could be understood to be something related to web pages, but however, MySQL doesn’t ring a bell in the minds of most people. For developers, the scenario is completely different. MySQL happens to be one of the best things that could happen to the World Wide Web, and developers know it very well! The database software is the backend of most web applications, thus accounting for its unfamiliarity with normal web users.

Databases are used with the purpose of storing user information and other data in the server and are useful for maintaining the application. Server-side scripting languages like PHP and Perl can access data from the database and represent them in web pages for public display. However, the storage and the communication with the database are not very simple. Databases need to be very secure applications themselves, and under no circumstances should data be modified or deleted without proper authorization. The fact that MySQL is used as the database application for over 30 million web applications puts an end to all questions over its integrity and efficiency.

Sun Microsystems, the owner of MySQL software, does a good job in adding new features to the core package, and publish it as a new edition. The latest version family under release is the MySQL 6.x. There are some extremely promising features in the latest package that has the potential to redefine the way web applications are made. Here, we will discuss some of the features that have been newly introduced in MySQL 6.x.

MySQL 6 Features

1. Supplementary Characters: MySQL has always been a supporting different improvement of Unicode character set. Previously in its older editions, it has supported two character sets of Unicode: utf-8 and ucs-2. These are good enough till the Unicode version 3.0 where the code values range from 0 to 65535 and are encoded with a maximum of 24 bits. However, in the latest version 5.0 there are 99089 characters that are defined. All these characters cannot possibly fit into the Basic Multilingual Plane (BMP) as in version 3.0. Hence the additional characters are called supplementary characters. MySQL 6.x has taken a step ahead to support these supplementary characters, along with supporting utf-8, utf-16 and utf-32 too. The other reason why the change has been inevitable because Windows Vista, the latest operating system by Microsoft supports supplementary characters.

2. Online backup – Backup is an important aspect of any database software. Data cannot be lost under any circumstances, and thus backups come in handy in case some unforeseen incidents happen with the original database. The online backup database can read one or more databases into a backup image file. Similarly, the image file can also be written on to one or more databases. Therefore, in case a database is lost, all one needs to do is to make use of the backup database. However, the word “online” does not refer to the fact that the backup image resides on a web server, but only means that there would be “no blocking” during the backup process.

BounceWeb offers the latest MySQL Hosting and once MySQL 6 comes out, our Shared Hosting Plans will have it available.

Advanced features of phpmyadmin

June 22nd, 2009 | Posted under Computer Advice, Software, The Internet, Web Hosting, Web Hosting Tips | No Comments »

Advanced features of phpmyadmin

As you may accept realized, the PHP accent revolves about the axial affair of practicality. PHP is about providing the programmer with the all-important accoutrement to get the job done in a quick and able fashion. Five important characteristics making in PHP’s :
1. Familiarity
2. Simplicity
3. Efficiency
4. Security
5. Flexibility

Installing PhpMyAdmin Advanced Features

To install the advanced features of phpMyAdmin you have to create a special control database that PMA uses to store bookmarks and relationships etc… PMA comes with a script called create_tables.sql that include the relevant sql statements to set these tables up. Gradually, when you install phpMyAdmin directly from source, this create_tables.sql script can be found in the scripts sub-folder.
Firstly, unzip and run the create_tables.sql file:
cd /usr/share/doc/phpmyadmin/examples
sudo gunzip create_tables_mysql_4_1_2+.sql.gz
mysql -u root -p < create_tables_mysql_4_1_2+.sql
Then setup a user/password for phpMyAdmin to use:
mysql -u root -p -e ‘GRANT SELECT, INSERT, DELETE, UPDATE ON `phpmyadmin`.* TO ‘pma’@’localhost’ IDENTIFIED BY “password”‘
Then edit the config file, and uncomment the extra features options for your chosen server, and add the individual / password you setup in the previous step. If you haven’t edited this enter before you may requirement to also uncomment the rest of the server definition.
sudo vim /etc/phpmyadmin/config.inc.php
Setting up foreign keys in phpMyAdmin?
InnoDB allows you to add a fresh foreign key constraint to a table by using ALTER TABLE:
ALTER TABLE tbl_name
[index_name] (index_col_name, …)
REFERENCES tbl_name (index_col_name,…)
[ON DELETE reference_option]
[ON UPDATE reference_option]
On the other hand, if MyISAM has main advantages over InnoDB in your context, why would you need to create foreign key constraints at all. You can handle this on the model level of your application.
Create a sample database using your PMA, into this database run the following SQL query:
CREATE TABLE `profiles` (
`id` int(11) NOT NULL auto_increment,
`content` mediumtext NOT NULL,

CREATE TABLE `users` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`profile_id` int(11) default NULL,

Hopefully this helps you with a short intro to the Advanced Features of PHPmyAdmin

All of BounceWeb’s PHP Hosting Plans include PHPmyAdmin

Web Hosting Technologies

April 15th, 2009 | Posted under Web Hosting, Web Hosting Tips | No Comments »

Web Hosting Technologies

There are different technologies that are in use today for hosting websites, and the main determinant of the kind of technology to be used for hosting would mainly intended purpose of the site, the operating system that the user would wish to run their server on and the traffic that is expected to the website to be developed. Other considerations in making this choice would be the costs that are associated with the specific technology.

Among the most common web hosting technologies are for web hosting that is specific to the operating system is the Unix Hosting which runs on the Unix platform, that is generally known to be a cheaper option to Windows hosting and more reliable as well. It would be worthy to note that this was the first web server platform to be used. Linux Hosting is specific to the Linux platform as well.

Some technologies allow users without much knowledge of web development to develop web sites, and this is because most of the groundwork like page-counters is preinstalled. These are Adobe Dreamweaver and Microsoft FrontPage. The Dreamweaver technology supports several other technologies that are in use like PHP, and CSS.

In making busy, dynamic and highly interactive web sites, the databases would be developed on MySQL database and PHP technology, which is widely used because it is free, efficient and can be altered to the web developers’ specific desire since it is open-source. PHP is mainly used for developing highly interactive websites as its code can be easily attached to HTML code.

Where there are security concerns in the types of data that will be stored in the servers and transmitted to specific users, there is reason to have a secured and protected hosting. The technology used is Secure Server which transmits encrypted data. These would mostly be web sites supporting online trading where transactions are involved or where intelligence content and communication is part of the intended use.

Other technologies in use are JSP which can create web pages by inserting Java code in HTML pages, CGI whose script codes are executables and would be used in making interactive web pages.

The range of web hosting technologies is quite wide, depending on the developer of a website and their interest, there is a technology that fits different situations. It would however be necessary to consider the type of database that would be put to use. Web sites can be hosted for free, as Free Hosting, or Shared Hosting where the server is shared between several sites or as Dedicated hosting, where a server only hosts one website.

BounceWeb offers shared hosting with PHP, MySQL, JSP, a SiteBuilder and a friendly control panel called cPanel to help you get started.

Web Hosting Considerations

April 15th, 2009 | Posted under Web Hosting, Web Hosting Tips | 6 Comments »

Web Hosting Considerations

Do you have a website and all you need is a web hosting provider? It is important to get to know a few things about web hosting before you choose a company to host your website. The first thing you need to know and understand is what exactly it is that you require in your website hosting. If you want to host a personal website, then all you need is plenty of disk space – enough for the website and the host. For other types of website, especially those that deal with online businesses, then you will need to consider a few things before you choose a host.

You need to consider the kind of hosting you want. If it is for heavy traffic or if your website requires complex applications, what you need is dedicated hosting. You can choose Shared hosting for much simpler websites. You can also choose between Linux and Windows Hosting. If your website has server technologies such as PHP, JSP or MySQL you would probably consider a Linux based web host.

Another important consideration is space and bandwidth requirements. If your website will have a lot of downloading of material, then you will require disk space that is 15 to 30 GB. You will have to do an accurate estimate of the bandwidth you need if your website is expected to receive a lot of traffic. Parked Domains and sub-domains are some of the most important features that your web hosting provider should have. In case you have co-workers on your website project working from different areas, you will need many FTP Accounts. If you plan to allow the users to gain access certain directories on your web server, then an Anonymous FTP is useful. Get a hosting provider that has e-commerce features if you must have them.

Other Web Hosting Considerations

A proper web hosting provider should have more than 99.5% uptime. Make sure that your website operates on a 24 hour basis if it is business oriented. Get a web hosting provider with a server that is fast enough to meet all your requirements. It is recommended that you the hosting provider should have a fiber option connection to the Internet server. Ensure that your site does not take more than 30 seconds to load. The web hosting provider should have Server backups that can keep data from getting lost.

The web hosting provider you choose should have disk space and bandwidth that satisfies your website requirements.  The hosting provider should also provide CGI, SSH, FTP and Anonymous FTP access. The provider’s software should be extensive. It should also have POP3 and IMAP e-mail accounts as well as web-based e-mail, mailing lists and antivirus. To make sure that you are risk free, choose a provider that has a money-back guarantee. If you follow all the above mentioned considerations, you will have a web hosting provider that will help your website be a success story.

BounceWeb offers both shared web hosting, and reseller web hosting with all the space and technology that you need to run your site.

How to backup/restore your MySQL database?

January 20th, 2009 | Posted under Web Hosting Tips | No Comments »

There are many ways to do this task, and i’ll explain two ways that you can use to restore mysql backups or backup your mysql databases.

Backup of MySQL Database using PHPMyAdmin

– Open your PHPMyAdmin, clicking on the corresponding icon in cPanel. On the left menu, click on the database you wish to backup;

– Click on the Export tab on the right side;

– Make sure you selected to export your entire database, not just one table. All the tables should appear in the export list, so you can pick the ones you want to backup;

– Select “SQL” for output format, check “Structure” and “Add AUTO_INCREMENT” value. Check “Enclose table and field name with backquotes”. Check “DATA”, check use “hexadecimal for binary field”. Export type set to “INSERT”.

– Check “Save as file”, do not change the file name, use compression if you want. Then click “GO” to download the backup file.

Restoring a backup of a MySql database using PHPMyAdmin

–  To restore a database, you click the SQL tab;
– On the “SQL” page , unclick the show query here again;
– Paste the code you wish to restore;
– Click Go;

Alternatively to this method you can click on the Import tab and choose the filename (with sql extension) that you wish to restore and click “Go”.

Creating a backup of your MySQL database using SSH

– If you have shell access on your hosting account, you can easily backup your database using the following command:

# mysql -u username -p database_name > filename.sql


username = root or database user with enough privileges to create this backup;

database_name = the name of the database you want to backup;

filename = name of the output file with sql extension;

Restoring a MySQL backup using SSH

The restore procedure is almost like the above, you just have to change a symbol. Easy, don’t you think?

# mysql -u username -p database_name < filename.sql


username = root or database user with enough privileges to restore this backup;

database_name = the name of the database you want to restore data into;

filename = name of the input file with sql extension;

Note: when doing backup/restore using SSH, you have to create the database and user before executing the command, or else it will not work!

Next Entries