I'm new to php & developing a page where i want to fetch data from db & the pagination should be in alphabetical format. i.e A|B|C| .... On click of A it should display names starting with A only. Currently i'm just using LIMIT function. Please Help !
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="testmra"; // Database name
// Connect to server and select databse.
$conn=mysqli_connect($host,$username,$password) or die("cannot connect");
mysqli_select_db($conn,$db_name);
$sql = "SELECT * FROM newuser WHERE role='User' ORDER BY name asc LIMIT 15";
$query = mysqli_query($conn,$sql);
echo "<table border='1' id='mytable' width='100%'>
<tr><th colspan='9' align='center'><h2>User Details</h2></th></tr>
<tr bgcolor='grey'>
<th width='25%'>Full Name</th>
<th width='25%'>Department</th>
<th width='25%'>EmailId</th>
<th width='25%'>Username</th>
</tr>";
while($row = mysqli_fetch_array($query))
{
echo "<tr>";
echo "<td align='center'>" . $row['name']. "</td>";
echo "<td align='center'>" . $row['department']. "</td>";
echo "<td align='center'>" . $row['emailid'] . "</td>";
echo "<td align='center'>" . $row['username'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($conn);
?>