data show site, PHP-MYSQL Course
              In the steps of this tutorial, I will be using the XAMPP server  for Windows ...     Mars 2015     
    The Steps to Create the Show and display the current View data  in database
  1. The Testing Server
  2. Defining a Dreamweaver Site
  3. Create A Database
  4. index.php page File
     
  5. Show or Preview Display the page site
 
 
data show
pages site
 
 
 
 
Developed with
PHP
 
 
 

The Testing Server        

If you wish to install a local testing server, you can download the XAMPP package for Windows http://www.apachefriends.org/en/xampp.html

Once XAMPP is a completely installed. XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl.
 
You can use the XAMPP Control Panel to start your testing server.

  1. Click Start next to both Apache and MySQL to start the services.
    Starting these services can take a few seconds. When it is complete, 'Running' will display beside each option.
 
To make your testing server start automatically when your computer starts, you can check the Svc checkbox beside both options.
If the XAMPP Control Panel is not already running, go to C:\xampp\control.exe to open the panel.

1- XAMPP Control Panel
 

With your testing server now installed and running, there are a few final steps you should take to make sure everything is configured to work perfectly.

  1. Open a web browser such as Firefox or Internet Explorer.
  2. In the Address bar, enter http://localhost.
    You should see a XAMPP splash screen with language options.
  3. Choose your preferred language.
    You should now see a confirmation window informing you that 'You have successfully installed XAMPP on your system'
 
 2- List of Files

the php and txt files corresponding, stored at data show Folder:
1-  index.php - php file
2-  Text-Doc - txt file
 
Defining a Dreamweaver Site
Once a testing server is set up, either locally or using a remote hosting service, you will need to define a site for Dynamic Development in Dreamweaver
 

Step 1: Start the site definition

In Dreamweaver go to Site -> New Site.

Note: you can edit an existing site definition by going to Site -> Manage Sites. Select the site you wish to modify, then click the edit button.

 

Step 2: Enter the local Information

In the first section of the site definition, you will set the Local Information. This sets the Site Name, and local path for files in your site.

When using XAMPP in a windows system, it may be that the site root is mapped to:
C:\xampp\htdocs
so the new site folder would be created under that location: C:\xampp\htdocs\myDBsite

In this screen shot, using DW CS6 on a Windows system with XAMPP installed. you will set the Local Information. This sets the Site Name, and local path for files in your site.
Site Name:           myDBsite
local Site Folder: C:\xampp\htdocs\myDBsite

 

Step 3: Servers

The next setting is to connect to servers. In DW CS6 and above, this done by selecting the servers section:

 
and clicking the plus icon to define a new server connection.
at Basic tab, For the Name you can enter the same name as the Site definition, When using a local testing server, set Connect Using to "Local/Network"
Set the Server Folder to the same location as the local files set in the initial Site Settings.
Server Name:           myDBsite
connect using:             Local/Network
Server Folder:          C:\xampp\htdocs\myDBsite

Web URL:                http://localhost/myDBsite
 
at Advanced tab,
Click the advanced button and set the Application model to PHP / MySQL
Server Model:  PHP MySQL 
then click Save.
Once the connection is defined, there are check boxes to set the connection as a testing or remote connection, check the testing option.
and then Click Save, the Dreamweaver dialog box display:
 
Step 4: Manage Sites
you can edit an existing site definition by going to Site -> Manage Sites. Your Sites: myDBsite
then click Done
Setup the site's Testing Server and then click OK
 
Create A Database
In this section, we'll look into how to create a database. A database is used to store information for your site.
Most web hosts use a control panel for managing your site, in the control panel they will have a way to create a MySQL Database. Once a database has been created, you can use phpMyAdmin to edit it.
phpMyAdmin is also available using most Local Testing server packages like XAMPP. The Start pages for those server will have a link to open phpMyAdmin.



Step 1: Create Database, Table and Insert data
in phpMyAdmin, go to the Databases tab :
  in Create database input myDB and click the Create button to have the database created:
 
go to the Structure tab. the myDB database that we will be using :
Create table Name = MyGuests,  Number of columns = 3, click Go
 
information about the 3 columns of myguests tables:
1- column:  id        int(11)                Auto_increment
2- column: firstname   vachar(80)
3- column: lastname   vachar(80)
 
go to the Browse tab. to Browse values of columns data
 

 
index.php page File
 
Now that a site and a database are created, lets connect the 2 together.

Before creating the database connection, a new PHP file needs to be created and saved to the site

Step 1: Create a New PHP page

Go to File -> New. In the File Creation dialog, select Blank Page. From the page type section, select PHP and click the create.

 

Step 2: Save the page to your site

Go to File -> Save.
In the Save As option, enter "index.php"

In the Where section, select the folder for your site.

 
Step 3: the Site has been defined
- testing server
-
Once the site has been defined, at Dreamweaver - Dw display current Message: "This page may have dynamically-related files that can only be discovered by the server. Discover | Preferences.
 
Step 4: Create the connection to the database
1) open the database panel by going to Window -> Database.

2) In the database panel, click the plus button and select MySQL Connection

3) enter the:
connection name:        conmyDB
MySQL server:          localhost
User name:                 root
Password:                                                 

Database:                  mydb
when click Select Button, to be display Select Database box, select mydb and then click Ok
4) Click the test button then Click OK
5) Click OK
 
Step 5: The Design and Code of index.php

 1- The Design of index.php
 
2- The Code of index.php
<!DOCTYPE html>
<html>
<body>

<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "myDB";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

$sql = "SELECT id, firstname, lastname FROM MyGuests";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<br> id: ". $row["id"]. " - Name: ". $row["firstname"]. " " . $row["lastname"] . "<br>";
}
} else {
echo "0 results";
}

$conn->close();
?>

</body>
</html>

 

Show or Preview Display the page site

Preview the recordset page in the browser.

in Dreamweaver, select or open index.php file,
Go to File -> Preview in Browser -> IExplore or chrome, to Show and display the current View ...
 
 
pure software code