Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Paginate dummy question

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
thiebo
Smarty Pro


Joined: 16 Jan 2005
Posts: 144
Location: Paris

PostPosted: Sun Jan 30, 2005 6:12 pm    Post subject: Paginate dummy question Reply with quote

The question I have probably is pretty simple, and I apologize for still not understanding.

However, I do not succeed to get the paginate function :

This is my .php code :

[php:1:087ea957ef]<?php
if(isset($_POST['multi']))
{
$motcle = $_POST['motcle'];
$anmin = $_POST['anmin'];
$anmax = $_POST['anmax'];
$nom_auteur = $_POST['nom_auteur'];
$resume = $_POST['resume'];
$auteur = $_POST['auteur'];
$contrat = $_POST['contrat'];

$connexion = connexion (NOM, PASSE, BASE, SERVEUR);
$query = "SELECT * FROM Actes, Bibliographie
WHERE Bibliographie.id = idBiblio
AND MotsClef LIKE '%$motcle%'
AND Nom_Auteur LIKE '%$nom_auteur%'
AND Resume LIKE '%$resume%'
AND Auteur LIKE '%$auteur%'
AND Contrat LIKE '%$contrat%'
AND annee BETWEEN $anmin AND $anmax ORDER BY annee
LIMIT ". SmartyPaginate::getCurrentIndex() . ", ". SmartyPaginate::getLimit() ;
$actes=sql_query($query);
$smarty->assign($actes, get_db_results());
SmartyPaginate::assign($smarty);
$smarty->display('actes.tpl');
}
?>[/php:1:087ea957ef]


the function :

[php:1:087ea957ef]<?php
function get_db_results($actes)
{
$_data = $actes;
SmartyPaginate::setTotal(count($_data));
return array_slice($_data, SmartyPaginate::getCurrentIndex(), SmartyPaginate::getLimit());
}
?>[/php:1:087ea957ef]


AND the error messages :
Quote:
[client 127.0.0.1] PHP Warning: Missing argument 1 for get_db_results() in /var/www/html/smartysite/fonctions.php on line 54, referer: http://localhost/smartysite/recherche.php
[client 127.0.0.1] PHP Warning: array_slice(): The first argument should be an array in /var/www/html/smartysite/fonctions.php on line 58, referer: http://localhost/smartysite/recherche.php



There must be something very basic that I am missing, could anyone please help ?

Many thanks,

Thiebo
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP