Problems:
## Discuss the procedure of the storing data in MySQL and retrieving data from MySQL database using PHP program. 2010,2015
## How to Insert and retrieve data from MySQL database using Program
<?php
$server_name = "localhost:3308";
$db = "tufan";
$user_name = "root";
$pass = "";
//Create Connection
$conn = new mysqli($server_name,$user_name,$pass,$db);
//Check Connectio
if(!$conn){
die ("Database problem!!!");
}
else{
echo "Connection Ok";
}
//insert data into Mysql database table
$a= "INSERT INTO boss(id,FastName,LastName) VALUES(1,'Tufan','islam')";
if(mysqli_query($conn,$a)){
echo "data insert ok";
}else{
echo "data insert failed";
}
//retriving (shows) data
$b="SELECT* FROM boss";
$result = mysqli_query($conn,$b);
if(mysqli_num_rows($result)>0){
while($row = mysqli_fetch_array($result)){
echo "<br>";
echo $row['FastName'];
echo "<br>";
echo $row['LastName'];
}
}else "no record";
?>
Outout:
Connection OkTufan
islam
Screenshots of browser (output):
💬আরো পড়ুন এবং জানুন💬
- Create a password field in HTML form
- Basic Forms | HTML Input
- PHP Calculating GPA
- Write the php code to calculate the display GPA in the web browser
- How to Insert Data Into MySQL Database Table & Retrieving data form database Using PHP
- How to Insert and retrieving data from MySQL database using Program
- Creating a new database & Table in mysql Databases
Post a Comment