Saved X
Google login
SignUp with Email
X

Fetch all data from database in php

theindreshverma ( Added  Sep 27, 04:46 pm )
Login

Php select query with while loop

<?php
// create a connection
$con = mysqli_connect('localhost', 'root', '', 'database');
if(!$con) {
   echo 'Connection not established';
   die();
}
// select query
$query = mysqli_query($con, "Select * from table");
// get all data
while($row = mysqli_fetch_array($query)) {
   echo '<p>'.$row->column_name.'</p>';
}
?>

Sourcecode Tags

More Sourcecodes

More Sourcecodes