diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2001-04-16 17:45:23 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2001-04-16 17:45:23 +0000 |
| commit | a2f46eff39e547e40d042ce97851805b9f9efea4 (patch) | |
| tree | 674ce1bfe3af9dd6ca058b44d5d0fdf9e7b4ba29 /frontends/php/items.html | |
| parent | a23282b7b988f6bbe5e7f98170c88e0dfe24fc3b (diff) | |
Added PostgreSQL support for PHP frontend. Added database abstraction layer in frontend/php/include/db.inc.
git-svn-id: svn://svn.zabbix.com/trunk@42 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/items.html')
| -rw-r--r-- | frontends/php/items.html | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/frontends/php/items.html b/frontends/php/items.html index 0b218114..dd4c33ee 100644 --- a/frontends/php/items.html +++ b/frontends/php/items.html @@ -33,7 +33,7 @@ ?> <? - $result=mysql_query("select hostid,host from hosts order by host",$mysql); + $result=DBselect("select hostid,host from hosts order by host"); if(isset($hostid)) { echo "<A HREF=\"items.html\">all</A> "; @@ -42,10 +42,10 @@ { echo "<b>[<A HREF=\"items.html\">all</A>]</b> "; } - while($row=mysql_fetch_row($result)) + for($i=0;$i<DBnum_rows($result);$i++) { - $hid=$row[0]; - $host=$row[1]; + $hid=DBget_field($result,$i,0); + $host=DBget_field($result,$i,1); if($hostid == $hid) { echo "<b>["; @@ -69,13 +69,13 @@ { $whereonly="where h.hostid=i.hostid"; } - $result=mysql_query("select h.host,i.key_,i.itemid,i.description,h.port,i.delay,i.history,i.lastvalue,i.lastclock,i.status,i.lastdelete,i.nextcheck,h.hostid from hosts h,items i $whereonly order by h.host,i.key_,i.description",$mysql); + $result=DBselect("select h.host,i.key_,i.itemid,i.description,h.port,i.delay,i.history,i.lastvalue,i.lastclock,i.status,i.lastdelete,i.nextcheck,h.hostid from hosts h,items i $whereonly order by h.host,i.key_,i.description"); echo "<CENTER>"; - while($row=mysql_fetch_row($result)) + for($i=0;$i<DBnum_rows($result);$i++) { - $host=$row[0]; - $itemid_=$row[2]; - $hostid_=$row[12]; + $host=DBget_field($result,$i,0); + $itemid_=DBget_field($result,$i,2); + $hostid_=DBget_field($result,$i,12); // echo "\n<br><hr><b>=$host= =$lasthost=</b>\n"; if($lasthost!=$host) { @@ -122,19 +122,19 @@ echo "<TR BGCOLOR=#EEEEEE>"; $col=1; } - $host=$row[0]; - $port=$row[4]; - $delay=$row[5]; - $history=$row[6]; - $shortname=$row[0].':'.$row[1]; - $key=$row[1]; - $description=$row[3]; - $lastvalue=$row[7]; - $lastclock=date("y/m/d H:i:s",$row[9]); - $itemid_=$row[2]; - $status=$row[9]; - $lastdelete=date("y/m/d H:i:s",$row[10]); - $nextcheck=date("y/m/d H:i:s",$row[11]); + $host=DBget_field($result,$i,0); + $port=DBget_field($result,$i,4); + $delay=DBget_field($result,$i,5); + $history=DBget_field($result,$i,6); + $key=DBget_field($result,$i,1); + $shortname=$host.':'.$key; + $description=DBget_field($result,$i,3); + $lastvalue=DBget_field($result,$i,7); + $lastclock=date("y/m/d H:i:s",DBget_field($result,$i,9)); + $itemid_=DBget_field($result,$i,2); + $status=DBget_field($result,$i,9); + $lastdelete=date("y/m/d H:i:s",DBget_field($result,$i,10)); + $nextcheck=date("y/m/d H:i:s",DBget_field($result,$i,11)); echo "<TD>$host</TD>"; echo "<TD>$key</TD>"; echo "<TD>$description</TD>"; @@ -169,9 +169,8 @@ ?> <? - $result=mysql_query("select count(*) from hosts",$mysql); - $row=mysql_fetch_row($result); - if($row[0]>0) + $result=DBselect("select count(*) from hosts"); + if(DBget_field($result,0,0)>0) { echo "<a name=\"form\"></a>"; insert_item_form($itemid); |
