Normally you'd place a functions connecting to the database in the
API. If you look at first.php you'll see it calling
API functions several times. From line 107 in first.php:
// Call the modules API to get the items
$items = pnModAPIFunc('Example',
'user',
'getall');
This will call the Example_userapi_getall() function located in pnuserapi.php. If you open this file and locate the function you'll see that it's creating a connection to the database..
$dbconn =& pnDBGetConn(true);
.. and later using that connection to execute
SQL.
$result = $dbconn->SelectLimit($sql, $numitems, $startnum-1);
If you don't need to set a limit you can also execute the
SQL like this
$result =& $dbconn->Execute($sql);
When you're done fetching the result you should close the result set before returning the data you were looking for
--
Erik from
www.TenTonHammer.com [35]