1 |
dpavlin |
1.1 |
<? |
2 |
|
|
|
3 |
|
|
/* returns: |
4 |
|
|
$stocks hash array with date,time,type,current,change,high,low,open |
5 |
|
|
$time string time (or CLOSE) |
6 |
|
|
$date string date |
7 |
|
|
trash: |
8 |
|
|
$row, $sth, $row2, $sth2, datesytle (german) |
9 |
|
|
*/ |
10 |
|
|
|
11 |
|
|
$dbh->dbh_do("set datestyle='german'"); |
12 |
|
|
|
13 |
dpavlin |
1.4 |
$sql="select date(date),time(date),stocks.type as type,current,change,high,low,open from stocks order by stocks.date desc limit 1"; |
14 |
|
|
$sth = $dbh->prepare("$sql"); |
15 |
|
|
$sth->execute(); |
16 |
|
|
if ($row=$sth->fetchrow_hash()) { |
17 |
|
|
$row[type]=$row[type]; |
18 |
|
|
$row[current]=sprintf("%.2f ",$row[current]); |
19 |
|
|
$row[high]=sprintf("%.2f",$row[high]); |
20 |
|
|
$row[low]=sprintf("%.2f",$row[low]); |
21 |
|
|
$row[open]=sprintf("%.2f",$row[open]); |
22 |
|
|
$row[change]=sprintf("%.2f",$row[change]); |
23 |
|
|
$stock[]=$row; |
24 |
|
|
$time=$row[time]; |
25 |
|
|
$date=$row[date]; |
26 |
dpavlin |
1.1 |
} |
27 |
|
|
|
28 |
dpavlin |
1.3 |
if ($time == "23:23:23" || $time == "21:21:21" || $time == "22:21:21" ) $time="CLOSE"; |
29 |
dpavlin |
1.1 |
|
30 |
|
|
?> |