- Home
- Registration
- Database Design
- Password Keeper
- MySQL and Excel
- Learn MySQL
- Learn SQL
- Learn PHP
- Learn C++
- Learn Java
- Learn Visual Basic
- Affordable Hosting
- Domain Name
- 301 Redirect
- Hosting Tips
- Monitor Site
- CPanel: Mail
- CPanel: MySQL
- CPanel: File Manager
- phpMyAdmin
- Authentication
- Display from file
- CSS Fixed Layout
- CSS Float Layout
- SEO tips
- Form Validation
- Miscellaneous
- Advertise here
- Site map
- LaptopForLess
- Geeks´ Stuff
- Nerds´ Stuff
- Remote Control Toys
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.
Cool Handle
Buy Web Hosting Now!
Webhosting Pad 1.99/month
Get 15% off on all webhosting packages! Use code 15off.
http://www.justhost.com
Professional Hosting from Just Host $4.95/month - Unlimited disk space and transfers and host unlimited domains
I am using this host for my another web site www.best-your-trip.com
Drive more traffic to your business with Web hosting from Gate.com!
Did you find information useful? Send to your friend a link to this page
Please rate the tutorial
| Comments |
|---|
Web programming Tips