How to select a specific row from the database?
HTML :
<?php
session_start();
require('database/db1.php');
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="css/circle.css"/>
<title>Untitled Document</title>
</head>
<body>
<div class="clearfix">
<div class="c100 p<?php
$query = "SELECT * FROM data"; //here I want to get the data from first row i.e, pt=80
$result = mysqli_query($con,$query);
while($data = mysqli_fetch_array($result))
{
echo(''.$data['pt']);
}
?> big">
<span><?php
$query = "SELECT * FROM data";
$result = mysqli_query($con,$query);
while($data = mysqli_fetch_array($result))
{
echo(''.$data['pt']);
}
?>%</span>
<div class="slice">
<div class="bar"></div>
<div class="fill"></div>
</div>
</div>
<div class="clearfix">
<div class="c100 p<?php
$query = "SELECT * FROM data"; //here I want to get the data from second row i.e, pt=36
$result = mysqli_query($con,$query);
while($data = mysqli_fetch_array($result))
{
echo(''.$data['pt']);
}
?> big">
<span><?php
$query = "SELECT * FROM data";
$result = mysqli_query($con,$query);
while($data = mysqli_fetch_array($result))
{
echo(''.$data['pt']);
}
?>%</span>
<div class="slice">
<div class="bar"></div>
<div class="fill"></div>
</div>
</div>
<div class="clearfix">
<div class="c100 p<?php
$query = "SELECT * FROM data"; //here I want to get the data from first row i.e, pt=56
$result = mysqli_query($con,$query);
while($data = mysqli_fetch_array($result))
{
echo(''.$data['pt']);
}
?> big">
<span><?php
$query = "SELECT * FROM data";
$result = mysqli_query($con,$query);
while($data = mysqli_fetch_array($result))
{
echo(''.$data['pt']);
}
?>%</span>
<div class="slice">
<div class="bar"></div>
<div class="fill"></div>
</div>
</div>
</body>
</html>
db1.php :
<?php
$host = "localhost";
$user = "pma";
$pass = "";
$db = "percentage";
$con = mysqli_connect($host,$user,$pass) or die("Could not connect: ".mysqli_error($con));
$db_select = mysqli_select_db($con,$db) or die("Could not connect: ".mysqli_error($db_select));
?>
This whole code is to create circular percentage. Here I have three circular percentages and I want each circular percentage container to take different values from the database like 80,36,56…
Thanks in Advance