/[hr-web]/inc/conn.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /inc/conn.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Fri Apr 20 08:25:32 2001 UTC (23 years, 1 month ago) by dpavlin
Branch: MAIN
Branch point for: pliva
Initial revision

1 dpavlin 1.1 <?php
2     include("inc/class.DBI");
3     include("inc/stuff.php");
4     function DBOpen($db = "education", $user = "test", $pass = "test") {
5     global $DBD, $DBH;
6     if ($DBH && $DBH->dbh) return;
7     $DBH = new DBI("dbi:$DBD:$db", $user, $pass);
8     if (!$DBH->dbh) {
9     $err = $DBH->errstr;
10     if (!$err) $err = "???";
11     echo "[Cannot connect to &quot;$db&quot;: $err]<BR>\n";
12     unset($DBH);
13     }
14     $DBH->dbh_do("SET DATESTYLE='ISO'");
15     }
16     function DBClose() {
17     global $DBH;
18     if (!$DBH || !$DBH->dbh) return;
19     $DBH->disconnect();
20     unset($DBH);
21     }
22     function &DBQuery($q) {
23     global $DBH;
24     if (!$DBH || !$DBH->dbh) return array();
25     $ret = array();
26     if (eregi('^\s*SELECT', $q)) {
27     $sth = $DBH->prepare($q);
28     if (!$sth) return array();
29     $sth->execute();
30     $ret = array();
31     while ($row = $sth->fetchrow_array())
32     array_push($ret, $row);
33     $sth->finish();
34     } else
35     array_push($ret, $DBH->dbh_do($q));
36     return $ret;
37     }
38     ?>

  ViewVC Help
Powered by ViewVC 1.1.26