Click here to Skip to main content
16,013,642 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can i show results in chart after search results am using this method,

i have a php file where results show after i search the database but i need to show the results in chart without the this code
<?php 

$dbhandle = new mysqli('localhost','root','','dbtest');
echo $dbhandle->connect_error;


$query = "SELECT sex, sum(sn) FROM person group by sex ";
$res = $dbhandle->query($query);

?>
and using the gstatic/loader.js the chart is showing but i want results based on my search

What I have tried:

<?php 
include("connect/db.php");  

 if(isset($_GET['id'])){
      $page_id = $_GET['id'];
$dbhandle = new mysqli('localhost','root','','dbtest');
echo $dbhandle->connect_error;


$query = "SELECT sex, sum(sn) FROM person group by sex where id='$page_id' ";
$res = $dbhandle->query($query);

 }
?>


i want the results from the search php file to be displayed on this page where the chart should show 

please help
Posted
Updated 23-Jan-18 4:41am

1 solution

The place you should do your filtering is on the server-side, via the SQL query. If this requires page-interaction, use AJAX [^] to refresh the search area when selections are made.

SQL is designed for searching, sorting, aggregating, and such. It will do a far better job than you and do it faster.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900