1 |
dpavlin |
1.1.2.1 |
<? |
2 |
|
|
|
3 |
|
|
// test interbase library functions |
4 |
|
|
|
5 |
|
|
$dbh=ibase_connect("localhost:/tmp/informatika","dpavlin","dpavlin"); |
6 |
|
|
$sth=ibase_query($dbh,"select * from osobe where id < 10"); |
7 |
|
|
print "<table>"; |
8 |
|
|
while ($row=ibase_fetch_row($sth)) { |
9 |
|
|
print "<tr><td>".implode("</td><td>",$row)."</tr></td>\n"; |
10 |
|
|
} |
11 |
|
|
print "</table>"; |
12 |
dpavlin |
1.1.2.2 |
print "<hr>"; |
13 |
|
|
print "<table>"; |
14 |
|
|
$sth=ibase_query($dbh,"select id,ime from osobe where id < 10"); |
15 |
|
|
|
16 |
|
|
while ($row=ibase_fetch_object($sth)) { |
17 |
|
|
$arr=(array)$row; |
18 |
|
|
print "<tr><td>"; |
19 |
|
|
print $row->ime.$row->ID; |
20 |
|
|
print "</tr></td>\n"; |
21 |
|
|
} |
22 |
|
|
|
23 |
|
|
print "</table>"; |
24 |
|
|
|
25 |
|
|
print "<hr><hr>"; |
26 |
|
|
|
27 |
|
|
// DBI test |
28 |
|
|
|
29 |
|
|
require('class.DBI'); |
30 |
|
|
$dbh = new DBI("dbi:interbase:/tmp/informatika","dpavlin","dpavlin"); |
31 |
|
|
$sth = $dbh->prepare("select * from osobe where id < 10"); |
32 |
|
|
echo $dbh->errstr; |
33 |
|
|
$sth->execute(); |
34 |
|
|
echo $dbh->errstr; |
35 |
|
|
print "<table>"; |
36 |
|
|
while ($row=$sth->fetchrow_array()) { |
37 |
|
|
print "<tr><td>".implode("</td><td>",$row)."</tr></td>\n"; |
38 |
|
|
} |
39 |
|
|
print "</table>"; |
40 |
|
|
|
41 |
|
|
|
42 |
|
|
$sth = $dbh->prepare("select * from osobe where id < 10"); |
43 |
|
|
$sth->execute(); |
44 |
|
|
print "<table>"; |
45 |
|
|
while ($row=$sth->fetchrow_hash()) { |
46 |
|
|
print "<tr><td>".$row->ID."</tr></td>\n"; |
47 |
|
|
} |
48 |
|
|
print "</table>"; |
49 |
|
|
|
50 |
dpavlin |
1.1.2.1 |
?> |