You are here: PEAR::DB -> ADOdb « Smarty Templates Posts « IT news, forums, messages
PEAR::DB -> ADOdb

Posted by Robert on 12/29/04 18:03

In my DB code I have:

$mode = DB_FETCHMODE_ASSOC;
$data = $dbh->getAll($stmt, $mode);
$page->assign('data', $data);

This prints out nicely in my template.

I am trying the SelectLimit in ADOdb (to learn some things) and I have this:

$startRow = 1;
$numRows = 5;

$db->SetFetchMode(ADODB_FETCH_ASSOC);
$result = $db->SelectLimit($sql,$numRows,$startRow);
$page->assign('data', $result);

This prints nothing at all...

I do a print_r on $result and it returns what I think it should. I get 5
arrays [0->4]:

[0] => Array
(
[SURNAME] => LAST
[FIRST_NAME] => FIRST
[USERID] => FILAST
[EMAIL] =>
[PROFILE] => PROF
[POSITION] => POS
[PRIMARY] => 0
[LAST_ACC_DATE] => 20041015
[PROFILE_LOGIN_LCKD] => N
)
etc...

In my template I do this:

{section name=set loop=$data}
<tr class="{cycle values="trcol1,trcol2"}">
<td>{$data[set].SURNAME}</td>
<td>{$data[set].FIRST_NAME}</td>
<td>{$data[set].USERID}</a></td>
<td>{$data[set].PROFILE}</td>
<td>{$data[set].POSITION}</td>
{if $data[set].PRIMARY eq "1"}
<td>YES</td>
{else}
<td>NO</td>
{/if}
<td>{$data[set].LAST_ACC_DATE}</td>
{if $data[set].PROFILE_LOGIN_LCKD eq "N"}
<td>NO</td>
{else}
<td>YES</td>
{/if}
{if $data[set].EMAIL eq ""}
<td>&nbsp;</td>
{else}
<td><a href="mailto:{$data[set].EMAIL}"><img
src="images/email.gif" alt="mail icon" /></a></td>
{/if}
</tr>
{/section}

Everything works fine with DB so I am at a loss and I probably don't
understand with SelectLimit is actually doing.

Robert

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация