I fed this chart
ButIhaveaprobleminselectingit
<?php$sql_2_vis=mysqli_query($config,"SELECT data, uniques, pageviews FROM tb_visitas ORDER BY id DESC LIMIT 7") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_2_vis) <= '0'){
echo "
<div class=\"col-lg-6\">
<div class=\"alert alert-danger\">
<strong>Erro!</strong> $erro
</div>
</div>
";
}else{
$count_vis = 0;
while($r_sql_2_vis = mysqli_fetch_array($sql_2_vis)){
$data_sel = $r_sql_2_vis[0];
$uniques_sel = $r_sql_2_vis[1];
$pageviews_sel = $r_sql_2_vis[2];
if($count_vis++) echo ', ';
echo '["' . date("d/m", strtotime($data_sel)) . '",' . $uniques_sel . ']';
}
}
?>
It would be necessary to display, in this case, 05/05, 06/05, 07/05 ... And it's the other way around.
If I give a ORDER BY id ASC
, it will get the first records.
I have seen in some places that it is possible to do a select within the select, but it did not work either.