1 |
<?php |
2 |
|
3 |
require("../dbi_pgsql.php"); |
4 |
|
5 |
$dbh = new DBI("corp","dpavlin",""); |
6 |
$sth=$dbh->prepare("set datestyle='german'"); |
7 |
$sth->execute(); |
8 |
|
9 |
$type='LSE'; |
10 |
|
11 |
$sql="select date(date) as date,xtime(date) as time,current as current,change from stocks where stocks.type='$type' order by stocks.date desc limit 1"; |
12 |
|
13 |
$sth = $dbh->prepare("$sql"); |
14 |
$sth->execute(); |
15 |
if ($row=$sth->fetchrow_hash()) { |
16 |
# print "--$sql--<br>"; |
17 |
$t=explode(":",$row[time]); |
18 |
$time="$t[0]:$t[1]"; |
19 |
$d=explode(".",$row[date]); |
20 |
$date="$d[0].$d[1]"; |
21 |
} |
22 |
|
23 |
# for close value fake time (now) |
24 |
if ($time == "23:23:23" || $time == "21:21:21" || $time == "22:21:21" ) $time=date("G:i"); |
25 |
|
26 |
$current=sprintf("%0.2f",$row[current]); |
27 |
|
28 |
print "#$date|$time|$current|$row[change]#\n"; |
29 |
?> |