Construct an application that successfully utilizes MySQL fe

Construct an application that successfully utilizes MySQL features by creating a short description of a PHP/MySQL project and this description please describe how it would be used, why it would be used and how MySQL and PHP page can interact.
Construct an application that successfully utilizes MySQL features by creating a short description of a PHP/MySQL project and this description please describe how it would be used, why it would be used and how MySQL and PHP page can interact.

Solution

//PHP & MySQL combination Application with Mysql Features//
//Please fill username and password of mysql application when you running //
<?php                           //php code begins open
$servername = \"localhost\";
$username = \"\";
$password = \"\";

// Create connection
   $conn = new mysqli($servername, $username, $password);   //mysqli is secured version type to connect mysql db
// Check connection
   if ($conn->connect_error)
   {
        die(\"Connection failed: \" . $conn->connect_error);
   }

// Create database
   $sql = \"CREATE DATABASE Test\";
   if ($conn->query($sql) === TRUE)
   {
        echo \"Database created !....\";
   } else {
        echo \"Error creating database: \" . $conn->error;
   }
//close connection opened
$conn->close();
?> //php code ends


<?php
$dbname = \"Test\";

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

// sql to create table
$sql = \"CREATE TABLE table1 (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
fname VARCHAR(30) NOT NULL,
lname VARCHAR(30) NOT NULL,
email VARCHAR(50),
reg_date TIMESTAMP
)\";

if ($conn->query($sql) === TRUE) {
    echo \"Table table1 created successfully\";
} else {
    echo \"Error creating table: \" . $conn->error;
}


//Insert Data Into Mysql Table table1

$sql = \"INSERT INTO table1 (fname, lname, email)
VALUES (\'Ashok\', \'Kumar\', \'ashok@as.com\')\";

if ($conn->query($sql) === TRUE) {
    echo \"New record created successfully\";
} else {
    echo \"Error: \" . $sql . \"<br>\" . $conn->error;
}


//Select Data in Mysql Table table1 and Displaying


$sql = \"SELECT id, fname, lname FROM table1\";
$result = $conn->query($sql);

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

 Construct an application that successfully utilizes MySQL features by creating a short description of a PHP/MySQL project and this description please describe
 Construct an application that successfully utilizes MySQL features by creating a short description of a PHP/MySQL project and this description please describe

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site