Doubts Select / PHP

0

I'm making a select this way.

$stmt = $lokos->prepare("select CODIGO_PROGRAMA, VERSAO_PROGRAMA,
                         DATA_INSERCAO, DESCRICAO_ALTERACAO from
                         programas_padrao Order by DESCRICAO_ALTERACAO DESC");

This select it will pull all the data it has in my database.

ex: PROGRAM 1, PROGRAM 2, PROGRAM 3

How do I do to my select or through if to display only the most recent one instead of displaying PROGRAM1, PROGRAM 2 and 3?

How do I display it for only 3?

This is the Original code. Which I can not do.

<?php

$user = "SYSDBA";
$pass = "masterkey";
try{
    $lokos=new PDO("firebird:localhost=127.0.0.1;dbname=DUOSIG_APLICACAO",$user,$pass);
}catch(PDOException $e) {
    echo "Falha na conexão.".$e->getcode();
}

$stmt = $lokos->prepare("select CODIGO_PROGRAMA, VERSAO_PROGRAMA, DATA_INSERCAO, DESCRICAO_ALTERACAO from programas_padrao Order by DESCRICAO_ALTERACAO DESC");
$stmt->execute();
$dados = $stmt->fetchAll(PDO::FETCH_OBJ);
foreach ($dados as $row) {
   echo "<li class='nome'>{$row->CODIGO_PROGRAMA} </li> ";
 echo "<li class='versao'>{$row->VERSAO_PROGRAMA} </li> ";
echo "<li class='data'>{$row->DATA_INSERCAO} </li> ";
echo "<li class='descricao'><p>{$row->DESCRICAO_ALTERACAO} </p> </li> ";
}

?>  
    
asked by anonymous 25.04.2017 / 17:08

0 answers