Dear friends,
Please guide me I want to display data in PHP form from mysql database. my code is below
<?PHP
//connect to database
$username = "root";
$password = "";
$database = "mydatabase";
$server = "127.0.0.1";
$conn= mysqli_connect($server,$username,$password,$database);
// checkintin connection
if($conn->connect_error){
die("".$conn->connect_error);
}
// select data
$sql = "SELECT * FROM myguests";
$result=$conn->query($sql);
if($result->num_row>0){
//output data of each row
while($row=$result->fetch_assco()){
echo "ID:".$row["id"];
}
}
else{
echo "no any record is in table";
}
$conn->close();
?>
what is there problem?