fetch data from sql server using php code example
Example: how to fetch data from database in php
<?php
$serve="localhost";
$user="root";
$password="";
$db="neha";
$con=mysqli_connect($serve,$user,$password,$db);
if ($con) {
echo "connection success";
}else
{echo "connection unsuccess"; }
$query="SELECT * FROM product";
$result=$con->query($query);
if($result->num_rows>0){
while($row=$result->fetch_assoc())
{
echo $name=$row['name'];
echo $qty=$row['qty'];
echo $price=$row['price'];
echo $image=$row['image'];
}
}
?>