CPanel - MySQL setup - File Manager

++++




CPanel - File Manager

Place this connect.php file in a directory that is upper than yur root directory. Click Home link on MySQL database and users screen and find a File manager icon.

File manager icon

Click File manager icon and you will see all your directories. The public_html directory is your root directory where all your html or php files are places. Select your home directory and click New Folder icon enter a name 'conn' and click Create Folder button.

Create folder

The folder will be created. Select the conn folder and click New File icon.

Create file

Enter connect.php for the file name and click Create New File button. The file is created.

edit file

A window opens and with the Disable Encoding Check button and Edit button. If you use latin characters for database users and name ignore Encoding check and click Edit button. Text editor opens. Type or copy and paste contents for connect.php file and save.

<?php

$hostname = "localhost";
$dbuser = "spillout_reg";
$dbpassword = "Kirkland9$";
$dbname = "spillout_mydb";

?>

File is saved.

In your web page that use connection to database you can type the following code to include connect.php file in the web page.

include('../conn/connect.php');

//code for connection:

mysql_connect( $hostname, $dbuser, $dbpassword)
                              or die ('Unable to connect to server.');

mysql_select_db($dbname )
                              or die ( 'Unable to select database.' );

$sql="select * from product" //let imagine that you have product table

              if(!$result=mysql_query($sql))
               {
               echo mysql_errno() . ": ";
               echo mysql_error() . "<br/>";
               }
               else
               {

               if(mysql_numrows($result))
               {
               //echo "some rows exist";

               while($row = mysql_fetch_row($result))
               {
               $product=$row[0];
               }

Example of using database for searching, inserting or updating records are given on web pages:

How to display data from MySQL on a web page

Demo PHP Application with MySQL database.

To create tables in the MySQL database and back up records you will use phpMyAdmin, which icon on the hosping panel is located next to MySQL database icon.



Cpanel File Manager

If you sign for hosting through one of 4 links on my site I placed below I will send you PHP authentication templates for free. See details user Authentication Demo

Hosting companies I use and recomend!

1. Fatcow.com I use it for www.configure-all.com, www.hardstuffez.com and www.healthstairs.com
40% off at FatCow!

2. www.bluehost.com
Host Unlimited Domains - 1 Account $6.95 Per Month

3. www.hostmonster.com
HostMonster - Perl, CGI, SSH, Free Domain

Affiliate Disclosure: I may get comission, when you purchase products or services through links on my website.


Did you find information useful?
Send to your friend a link to this page

If you like this page click +1 button.

Please rate the tutorial

1 2 3 4 5 6 7 8 9 10



How to Build Your Own Web Site from Scratch [Kindle Edition] $2.99

Earn Money on Internet as an Affiliate [Kindle Edition] $0.99

Comments
 
Register to add comments ( 1000 char ) for cpanel_file_manager.php.