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

Contents of /inc/stocks.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations)
Tue Mar 26 12:15:47 2002 UTC (22 years ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +2 -1 lines
changes made by back-end

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 $sql="select date(date),date as time,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 $time=str_replace($date,"",$time);
27 }
28
29 if ($time == "23:23:23" || $time == "21:21:21" || $time == "22:21:21" ) $time="CLOSE";
30
31 ?>

  ViewVC Help
Powered by ViewVC 1.1.26