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.
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.
The folder will be created. Select the conn folder and click New File icon.
Enter connect.php for the file name and click Create New File button. The file is created.
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.
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
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 | |
|---|---|
- Home
- cpanel_file_manager
- Batch Files
- Environment Variables
- Delete Trojan horse
- Java Properties
- Form Validation
- Display Image PHP
- Upload File PHP
- phpMyAdmin
- Domain Name
- Name Servers
- CPanel: Mail
- CPanel: MySQL
- CPanel: File Manager
- User_Auth. Demo
- Affordable Hosting
- Hosting Expenses
- Modeless Popup
- Read Screen Resolution
- 301 Redirect
- PHP + Oracle 1
- PHP + Oracle 2
- Hosting Tips
- Monitor Site
- Create Gallery
- Authentication Script
- Display from file
- CSS Fixed Layout
- CSS Float Layout
- CSS Tables
- Loading Speed
- Set Shopping Cart
- My Best CSS Layout
- Using Twitter
- SEO tips
- Database Design
- Password Keeper
- MySQL and Excel
- Learn MySQL
- Learn SQL
- Learn PHP
- Learn C++
- Learn Java
- Learn Visual Basic
- Site map
- Registration
Web programming Tips