Chisels: Crecsent Wrench: Hedge Clippers: Shipping Information First Name: Last
ID: 3859687 • Letter: C
Question
Chisels:
Crecsent Wrench:
Hedge Clippers:
Shipping Information
First Name:
Last Name:
Shipping Address
Street:
CITY:
Zipcode:
????????????
?>
Payment Method:
Visa
Master Card
American express
Explanation / Answer
1. Connect to the data base using any DBMS packages. Best suitable package for students is phpMyadmin.
2. Write code for connecting to the database.
3.Write query to retrieve data from database.
4. Execute query.
5. Display the result.
.........................Here is the sample code for the same........................
<?php
/*** mysql hostname ***/
$hostname = 'localhost';
/*** mysql username ***/
$username = 'username';
/*** mysql password ***/
$password = 'password';
// Create connection
$con=mysqli_connect(host,username,password,dbname);
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
else
{
$query="SELECT state_abbr, state_name from state_t ORDER BY state_name";
$result = $conn->query($queryl);
if ($result->num_rows > 0)
{
// output data of each row
while($row = $result->fetch_assoc())
{
echo $row["state_name"]; // displaying state name from table
}
}
?>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.