Hi Sirs,
The code I wrote are fine. But I cannot display records after filter. The what I need it's simple. I have two separate records on top of my form or outside of my form. After the interval of year be filtered I would love to see the first record be displayed on those separated inputs (girls on input1 and boys on input2). Any filter I do the first record should be displayed separetly. Thank you!
body {
background-color: #fff4e6;
}
table,th,td
{
border:1px solid white;
color:#1d3557;
}
table
{
border-collapse:collapse;
width:80%;
}
th
{
background-color: PaleVioletRed;
}
td
{
height:30px;
}
td:nth-child(1)
{
background-color: #a9bcd0;
}
td:nth-child(2)
{
background-color: #a9bcd0;
}
td:nth-child(3)
{
background-color: #a9bcd0;
}
td:nth-child(4)
{
background-color: #a9bcd0;
}
td:nth-child(5)
{
background-color: #a9bcd0;
}
td:nth-child(6)
{
background-color: #a9bcd0;
}
td:nth-child(7)
{
background-color: #a9bcd0;
}
td:nth-child(8)
{
background-color: #a9bcd0;
}
td:nth-child(9)
{
background-color: #a9bcd0;
}
td:nth-child(10)
{
background-color: #a9bcd0;
}
.button7 {
background-color: Brown;
color: white;
border-radius: 15px 50px 30px;
border: 0px solid #008CBA;
font-size: 30px;
width: 380px;
height: 50px;
text-align: left;
padding: 0px;
text-align: center;
}
.button7:hover {
background-color: #e7e7e7;
color: black;
}
.recherche {
background-color: MediumSlateBlue;
color: white;
border-radius: 25px;
border: 0px solid #008CBA;
font-size: 30px;
width: 120px;
height: 50px;
text-align: left;
padding: 0px;
text-align: center;
}
.recherche:hover {
background-color: #e7e7e7;
color: black;
}
if(isset($_POST['recherche']))
{
include('testdb.php');
$valueToSearch = $_POST['valueToSearch'];
// search in all table columns on a specific column
$query = "SELECT * FROM statflex_info WHERE year = '$valueToSearch'";
$search_result = filterTable($query);
}
else {
$query = "SELECT * FROM statflex_info ORDER BY id DESC LIMIT 10";
}
// function to connect and execute the query
function filterTable($query)
{
$connect = mysqli_connect("x","xx","xxx","xxxx");
$filter_Result = mysqli_query($connect, $query);
return $filter_Result;
}
?>
. Effectifs numériques total d'Elèves .
table,tr,th,td,td1
{
border: 1px solid white;
}
| code_city | girls | boys | total |
|---|---|---|---|
| " . $row['code_city'] . " | ";" . $row['girls_number'] . " | ";" . $row['boys_number'] . " | ";|
| $total_girls | $total_boys | $total | |
mysqli_close($con);
?>
IsraelPosted Feb 1, 2026, 1:37 PM
Not anyone to help one my codes please. I am stucked. Thanx!
IsraelPosted Feb 1, 2026, 11:37 AM
Hi Sirs,
code_city------------girls_number------------boys_number
paris002----------------------51---------------------------59
paris002----------------------30---------------------------33
Newdeli001------------------33---------------------------20
Newdeli001------------------125--------------------------85
Newdeli001-------------------66---------------------------25
paris002-----------------------77--------------------------100
When I filter the year he filter and display the first record as recommended. Unfortuntly the two last records disapear from the table and show ONLY the first row on the same table. My target is to filter the code's city without hidde others records from the table.
I am not sure if I am clear. Thank you.
Please could you see what I try to do. Its shown the first record but curiosly the table also show ONLY the single:
if(isset($_POST['recherche']))
{
include('testdb.php');
$valueToSearch = $_POST['valueToSearch'];
// search in all table columns on a specific column
$query = "SELECT * FROM statflex_info WHERE year = '$valueToSearch'";
$search_result = filterTable($query);
$firstRecordValue = "";
if ($search_result->num_rows > 0) {
$row = $search_result->fetch_assoc();
$firstRecordValue = $row['code_city'];
} else {
$firstRecordValue = "No records found";
}
}
else {
// function to connect and execute the query
function filterTable($query)
{
$connect = mysqli_connect("x","xx","xxx","xxxx");
$filter_Result = mysqli_query($connect, $query);
return $filter_Result;
}
?>
First Record Details
Details: