You are here: Re: AW: [SMARTY] direct way to handle mysql result sets (via resource id) with smarty « Smarty Templates Posts « IT news, forums, messages
Re: AW: [SMARTY] direct way to handle mysql result sets (via resource id) with smarty

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

Well, actually I do error handling... just simplified
my example...

function fetch_information(....){
....
$result = mysql_querry(...);
....
//if everything is ok... pass result
return $result;
}

so I would like to do this:
$smarty->assign('results', fetch_information(...));

.... to avoid creating huge arrays in the case of large
result sets!



--- Benjamin Bolbach <admin@doublebnet.de> schrieb:
> I don't think that kind of template design would be
> a good solution.
> It may seem to be a bit easier, but why don't you
> write a simple
> DB class with its own query function, that returns
> you a filled array
> On a select statement. Because the next thing to do
> is the error handling
> Inside smarty directly. So you give up the division
> of logic an output.
>
> Ben
>
> -----UrsprΓΌngliche Nachricht-----
> Von: JΓΆrg Hermsdorf [mailto:funtasyspace@yahoo.com]
> Gesendet: Montag, 2. Mai 2005 18:58
> An: smarty-general@lists.php.net
> Betreff: [SMARTY] direct way to handle mysql result
> sets (via resource id)
> with smarty
>
> 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
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.1 -
> Release Date: 02.05.2005
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.1 -
> Release Date: 02.05.2005
>
>
>




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

 

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

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