/[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

Annotation of /inc/stocks.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations)
Mon Mar 25 12:30:45 2002 UTC (22 years, 1 month ago) by dpavlin
Branch: MAIN
Changes since 1.4: +1 -0 lines
changes made by back-end

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 dpavlin 1.5 print "$sql";
15 dpavlin 1.4 $sth = $dbh->prepare("$sql");
16     $sth->execute();
17     if ($row=$sth->fetchrow_hash()) {
18     $row[type]=$row[type];
19     $row[current]=sprintf("%.2f ",$row[current]);
20     $row[high]=sprintf("%.2f",$row[high]);
21     $row[low]=sprintf("%.2f",$row[low]);
22     $row[open]=sprintf("%.2f",$row[open]);
23     $row[change]=sprintf("%.2f",$row[change]);
24     $stock[]=$row;
25     $time=$row[time];
26     $date=$row[date];
27 dpavlin 1.1 }
28    
29 dpavlin 1.3 if ($time == "23:23:23" || $time == "21:21:21" || $time == "22:21:21" ) $time="CLOSE";
30 dpavlin 1.1
31     ?>

  ViewVC Help
Powered by ViewVC 1.1.26