Eu preciso puxar o ID especifico de cada usuário para apresentar na tabela e está assim
I need to pull the specific ID of each user to display in the table and it's like this
<?php
$resul_ult_aces = "SELECT DATE_FORMAT(data_acesso, '%Y-%m-%d-%H-%i-%s') as
data_acesso FROM adms_ultimos_acessos
WHERE adms_usuario_id = '".$row_user['id']."'
ORDER BY id DESC LIMIT 1";
$resultado_ult_aces = mysqli_query($conn, $resul_ult_aces);
$row_ult_aces = mysqli_fetch_assoc($resultado_ult_aces);
?>
até ai tudo bem mais quando eu insiro o restante que é:
until then everything much more when I insert the rest that is:
<?php
$ob_data_acesso = $row_ult_aces ['data_acesso'];
$databd2 = date('Y-m-d-H-i-s');
$data1 = explode('-', $ob_data_acesso);
$data2 = explode('-', $databd2);
$ano = $data2[0] - $data1[0];
$mes = $data2[1] - $data1[1];
$dia = $data2[2] - $data1[2];
$hora = $data2[3] - $data1[3];
$min = $data2[4] - $data1[4];
$seg = $data2[5] - $data1[5];
if ($mes < 0) {$ano--; $mes = 12 + $mes; }
if ($dia < 0) { $mes--; $dia = 30 + $dia; }
if ($ano > 0) { $str_ano = $ano . ' ano'; }
if ($ano > 1) { $str_ano .= 's '; }
if ($mes > 0) { @$str_mes .= $mes . ' mes'; }
if ($mes > 1) {
if ($ano > 0) { $str_ano .= ', '; } $str_mes .= 'es'; }
if ($dia > 0) { $str_dia = $dia . ' dia'; }
if ($dia > 1) {
if ($mes > 0) { $str_mes .= ', '; } $str_dia .= 's'; }
if ($min < 0) {$hora--; $min = 60 + $min; }
if ($seg < 0) { $min--; $seg = 60 + $seg; }
if ($hora > 0) { $str_hora = $hora . ' hora'; }
if ($hora > 1) { @$str_hora .= 's'; }
if ($min > 0) { @$str_min .= $min . ' minuto'; }
if ($min > 1) {
if ($hora > 0) { @$str_hora .= ', '; } @$str_min .= 's'; }
if ($seg > 0) { $str_seg = $seg . ' seg'; }
if ($seg > 1) {
if ($min > 0) { $str_min .= ' e '; } $str_seg .= 's'; }
?>
<td class="d-none d-sm-table-cell">
<?php
echo @$str_ano, @$str_mes, @$str_dia,
@$str_hora, @$str_min, @$str_seg,' atrás';
?>
</td>
Ai dá erro na obtenção dos dados eu já descobri que é quando eu insiro as linnha
Ai gives error in obtaining the data I already discovered that is when I enter the lines
<pre>WHERE adms_usuario_id = '".$row_user['id']."'
ORDER BY id DESC LIMIT 1";
Quando eu tiro elas funciona certinho porém duplica para todas ou registros dos outros ID's e vai acrecentando sempre um a cada registro, acho que é por conta d a duplucação ai fica assim:
When I shoot them it works right but doubles to all or records of the other ID's and is always increasing one with each record, I think it's because of the duplication ai looks like this:
ID 01 --> 2 min
ID 02 --> 2 min 2 min
ID 03 --> 2 min 2 min 2 min
Já sei que é por causa das linhas que são responsáveis por puxar os dados especificos de cada ID mais não consegui resolver isso, HELP-ME!!!
I already know it's because of the lines that are responsible for pulling the specific data of each ID plus I could not solve it, HELP ME !!!
[Note]Google translator has been used for translation[/Note]
What I have tried:
a echo está pegando o valor das linha em aleatório tenho que limitar a o ID especifico apenas, foi isso que tentei sem sucesso até agora :(
echo is catching the value of the line at random I have to limit to the specific ID only, this is what I tried without success so far :(