Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Contributor: Ravishankar Chavarefetch data from mysql using php
#1
PHP Code:
<?php
//check database connection or include dbconfig file 
$sql "SELECT * FROM Mytable";
$result mysqli_query($conn$sql);

if (
mysqli_num_rows($result) > 0) {
    // output data of each row
    while($row mysqli_fetch_assoc($result)) {
        echo "Roll: " $row["rollno"]. " - Name: " $row["firstname"]. " " $row["lastname"]. "<br>";
    }
} else {
    echo "0 results";
}

mysqli_close($conn);
?>
Reply


Messages In This Thread
fetch data from mysql using php - by Ravishankar Chavare - 12-23-2017, 07:28 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)