Author Topic: new setDbLoop() function  (Read 1128 times)

0 Members and 1 Guest are viewing this topic.

releasedj

  • Guest
new setDbLoop() function
on: Tue, 16. July 2002 - 11:03:00
A new function has been added to vlibTemplate, setDbLoop().

This is an experimental function and it would be cool if some people could test it out.

It basically allows a user to pass a Db result resource to this function which will build the loop.

Currently the following Dbs are supported:
MySQL, PostgreSQL, Informix, Interbase, Ingres, MSSQL, MSQL, Oracle 8i (OCI8), Oracle, Ovrimos and Sybase.

Only the MySQL database has been tested, so I need the others to be tested if possible.

Check it out.

Kelvin

Offline ClausVB

  • Administrator
  • Hero Member
  • *****
  • Posts: 566
    • Homepage: clausvb.de
new setDbLoop() function
Reply #1 on: Fri, 16. August 2002 - 16:35:00
Yesterday I got "setdbloop" to work. It took so long because I did not realize, what your loop had to look like. Until I looked at the function, it was easy.

I am writing (german) docu about it and will post an example for INFORMIX here.

Since I program 90% of our PHP-INFORMIX scripts, I think I will get it to work.

I looked at SMARTY again, but it has nothing to offer (imho), and so I want to say (again :smile:):

Thanks again for your great class and all your work, Kelvin!

Best regards!

PS: I will ask an german-english friend of mine to translate my documentation, so it's availible for all vlibTemplate-Users.

releasedj

  • Guest
new setDbLoop() function
Reply #2 on: Sat, 17. August 2002 - 00:18:34
You're absolutely welcome.

It would be great to see an example for Informix.
Have you managed to get setDbLoop() to work with Informix.. I would love to know as I have only been able to test it on MySQl.

Many thanks Claus,

Kelvin

Offline ClausVB

  • Administrator
  • Hero Member
  • *****
  • Posts: 566
    • Homepage: clausvb.de
new setDbLoop() function
Reply #3 on: Thu, 22. August 2002 - 12:42:45
Code: [Select]
<?php
$db_host "database@ourserver";
$user "informix";
$pw "**********";

include "./vLib/vlibTemplate.php";

$connect ifx_pconnect($db_host$user$pw);

$tpl = new vlibTemplate(./tpl/template.htm);

$selStmt "SELECT l_key, l_name 
FROM liste16 WHERE l_gkz = 103 ORDER BY l_name"


$result ifx_query($selStmt$connect);

$tpl -> setdbloop(optionen$resultINFORMIX);
$tpl -> pparse();

ifx_close($connect);
?>

It is very important, that your template-variables are THE SAME as your cols. Like:

Code: [Select]
<tmpl_loop name=optionen>
<option value ={tmpl_var name=l_key}>{tmpl_var name=l_name}</option>
</tmpl_loop>
Last Edit: Tue, 02. January 2007 - 17:15:47 by ClausVB

releasedj

  • Guest
new setDbLoop() function
Reply #4 on: Thu, 22. August 2002 - 13:03:13
Looks good, and it works? .. cool.

Offline ClausVB

  • Administrator
  • Hero Member
  • *****
  • Posts: 566
    • Homepage: clausvb.de
new setDbLoop() function
Reply #5 on: Thu, 22. August 2002 - 14:57:52
Yes. It works fine. We were finished in 20 minutes. What can I say:

Good work!
Last Edit: Tue, 02. January 2007 - 17:16:09 by ClausVB