page result with mysql -- with plug-in function.return_paged_results.php
| From: | Ivan R. Cardoso | Date: | Sun, 23 Nov 2003 12:08:49 +0000 |
| Subject: | page result with mysql -- with plug-in function.return_paged_results.php | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-10588@lists.php.net to get a copy of this message | ||
After some time.... i finaly found a way to make the return_paged_results
(http://sourceforge.net/projects/smartypages/) plug-in to work.
look;
------------------------------------------------------------
(*.tpl)
{return_paged_results db=$db query=$query shown=10}
<table width=100%>
<tr
bgcolor=0000ff><td>cod</td><td>name</td><td>timestamp</td></tr>
{section name=mysec loop=$records}
{strip}
<tr class=celldados bgcolor="{cycle values="#f0f0f0,#999999"}">
<td width=10%>{$records[mysec].cod}</td>
<td>{$records[mysec].name}</td>
<td >{$records[mysec].timestamp}</td>
</tr>
{/strip}
{/section}
</table>
<p> {$page_string}
---------------------------------------------------------
(*.php)
$connection = mysql_connect("$hostname", "$username", "$password");
$db = mysql_select_db("$database", $connection);
$query = "select * from $table";
$smarty->assign('db',$db );
$smarty->assign('query',$query );
-----------------------------------------------------------
The only way that i found the plug-in to work, was to change(function.return_paged_results.php,
about line 74 and 101...) from this:
$count_result = mysql_query($count_query,$db);
To this:
$count_result = mysql_query($count_query);
hope it helps someone, cause i took a while to find out....!
Ivan R. Cardoso