Topic: Code for calling DB at PN.08
viking
avatar
Noob
Noob
Posts: 12

Posted:
Mar 13, 2008

Hi.. I coming again, here always my referrer if I stuck at PN.. :P

Ok.. I get this script from here..

Code
  1. <?php
  2.  
  3. function smarty_function_sumbisma($params, &$smarty) {
  4.  
  5. $cat = 2;
  6. $dalimit = 5;
  7.  
  8. list($dbconn) = pnDBGetConn();
  9. $pntable = pnDBGetTables();
  10. $query = "SELECT pn_sid, pn_title, pn_hometext, pn_informant, pn_time FROM $pntable[stories]
  11.         WHERE  pn_topic='".pnVarPrepForStore($cat)."'
  12.         ORDER BY pn_time DESC LIMIT ".pnVarPrepForStore($dalimit);
  13.  
  14. $result = $dbconn->Execute($query);
  15. while(list($sid, $headlinetitle, $story, $info, $stime) = $result->fields) {
  16.    $result->MoveNext();
  17.  
  18.     if ($stime >= date("Y-m-d H:i:s", strtotime("-3 DAY"))) {
  19.     $newimage = "images/global/new1.gif";
  20.     } else {
  21.     $newimage = "images/global/ldot.gif";
  22.     }
  23.  
  24. $content .= "<img src=\"".$newimage."\"> ";
  25.    $content .= " <a href=\"index.php?name=News&file=article&sid=".pnVarPrepForDisplay($sid)."\">";
  26.    $content .= "<b>".pnVarPrepForDisplay($headlinetitle)."</b></a>";
  27.  
  28.     $content .= "<br>$story";
  29.     $content .= "<br><div class=\"style2\"><B>Kiriman</B> :: <a href=\"user.php?op=userinfo&uname=".pnVarPrepForDisplay($info)."\">$info</a></div><br>";
  30. }
  31. printf($content);
  32. }
  33. ?>


BUT now I try to upgrade my site with latest PN.08 - So this script not work anymore.. (I think its about new category system)

So.. can you show me how can I change it ?

Thanks in advance..