Reply to Re: [SMARTY] direct way to handle mysql result sets (via resource id) with smarty

Your name:

Reply:


Posted by Jφrg Hermsdorf on 05/02/05 20:18

Well, I'm not only looking for a simpler syntax.
Think of an result set with 15 columns and 2000 rows.
Considering memory and performance, I'm not sure if it
is a good idea to create such an large array (15x2000
fields) just to be able to display the result set
using smarty... I'd prefer a solution without creating
an array at all...

--- Monte Ohrt <monte@newdigitalgroup.com> schrieb:

> There are tons of ways to handle this, and certainly
> not a function of
> Smarty. If you're just looking for a simpler syntax,
> create a function
> that encapsulates the work:
>
> $smarty->assign('results', get_db_rows("select *
> from foo"));
>
> JΓΆrg Hermsdorf wrote:
>
> >Hello List,
> >I would like to know if there is an easier way to
> >handle MySQL result sets in smarty? Currently I
> only
> >know of the approach to prepare an array out of the
> >resource id returned by mysql_query() :
> >
> >...
> >$result = mysql_query('SELECT * FROM ...');
> >while ($row = mysql_fetch_assoc($result))
> >{
> > $result_array[] = $row;
> >}
> >$smarty->assign('results', $result_array);
> >
> >Then I can use the result set within the {foreach
> >item=result from=$result_array}{/foreach} function.
> >
> >But I'm looking for another way, where I can
> directly
> >assign the resource like this:
> >
> >$smarty->assign('results', mysql_query('SELECT *
> FROM
> >...'));
> >
> >... is there a foreach-like smarty-plugin-function
> >that can handle a "resource id" instead of an
> array?
> >
> >Thanks, JΓΆrg.
> >
> >
> >
> >
> >
> >
>
>___________________________________________________________
>
> >Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher
> kostenlos - Hier anmelden: http://mail.yahoo.de
> >
> >
> >
>
>





___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de

[Back to original 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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация