Limit of rows database Joomla

0

Good afternoon, I'm trying to limit the display of database results to 200, but when I use the "LIMIT 200" command nothing happens:

Follow the code below the connection:

<?php
if(!defined('_VALID_MOS')){
    define('_VALID_MOS', 1);
}
if(!defined('CURRENT_DIRECTORY')){
// JPATH_BASE should point to Joomla!'s root directory
    define('CURRENT_DIRECTORY', realpath(dirname(__FILE__)) . '/');
}
if(!defined('DS')){
    define('DS', DIRECTORY_SEPARATOR);
}
require_once ( JPATH_BASE . DS . 'includes' . DS . 'defines.php' );
require_once ( JPATH_BASE . DS . 'includes' . DS . 'framework.php' );
require_once ( CURRENT_DIRECTORY . 'custom.fields.php' );
$mainframe = & JFactory::getApplication('site');
$mainframe->initialise();
$user = & JFactory::getUser();
$session = & JFactory::getSession();
$db = & JFactory::getDBO();

$query = " SELECT * FROM #__content WHERE alias='conveniados' LIMIT 200";
$db->setQuery($query);
$result = $db->loadAssoc();

$customFields = json_decode(CustomFields::getFields($result["id"]));
?>

This is the display code for the lines:

<div class="conv-lista">

        <div class="conv-lista-header">
            <span>Conveniados</span>
        </div>

        <div class="conv-lista-inner">
            <div class="conv-lista-overflow">
                <?php foreach($conveniados as $conveniado){ ?>
                <div 
                class="conv-lista-item" 
                especialidade="<?php echo $conveniado["categoria"]; ?>"
                local="<?php echo $conveniado["cidade"]; ?>"
                nome="<?php echo $conveniado["nome"]; ?>"
                servicos="<?php echo $conveniado["servicos"]; ?>"
                >
                    <div class="lista-item-imagem">
                        <?php if($conveniado["imagem"] != ''){ ?>
                        <img border="0" src="<?php echo $conveniado["imagem"]; ?>" alt="<?php echo $conveniado["nome"]; ?>" />
                        <?php } else { ?>
                        <img border="0" src="<?php echo JURI::base(); ?>images/blank-conv.jpg" alt="<?php echo $conveniado["nome"]; ?>" />
                        <?php } ?>
                    </div>
                    <div class="lista-item-info">
                        <p class="info-t" title="<?php echo $conveniado["nome"]; ?>"><?php echo $conveniado["nome"]; ?></p>
                        <p>Categoria: <?php echo $conveniado["categoria"]; ?></p>
                        <p><?php echo $conveniado["endereco"]; ?>, <?php echo $conveniado["bairro"]; ?>, <?php echo $conveniado["cidade"]; ?> - <?php echo $conveniado["estado"]; ?></p>
                        <p><?php echo $conveniado["telefone"]; ?></p>
                    </div>
                </div>
                <?php } ?>
            </div>
        </div>

    </div>

They are displaying without control, in a total of 2000 lines, in that case it leaves the site very heavy.

    
asked by anonymous 04.06.2018 / 18:18

0 answers