"); //include fn.php for use below $dir='.'; include($dir.'/fn.php'); //call retrieving function in fn.php for the major indices //^DJI, ^IXIC, and ^GSPC are Yahoo! Finance designations for the indices //retrieve obtains current value, change in points, and change in percent //retrieve also continues printing in table started below echo "
"; echo "Dow Jones Industrial | "; $markets = '^DJI'; $quotes = retrieve($markets); echo "
NASDAQ Composite | "; $markets = '^IXIC'; $quotes = retrieve($markets); echo "
Standard & Poor's 500 | "; $markets = '^GSPC'; $quotes = retrieve($markets); echo "
"; echo "
Portfolio of $ViewMethod
";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "
";
$link = mysql_connect("magnesium.tjhsst.edu", "jhess", "939525");
mysql_select_db("jhess", $link);
if ($ViewMethod=="Mr. Latimer")
$query = "select * from latimer";
if ($ViewMethod=="Yosemite Sam")
$query = "select * from sam";
$result = mysql_query($query, $link);
$num_rows = mysql_num_rows($result);
echo "
Stock | "; echo "Quantity | "; echo "Price | "; echo "Change | "; echo "Information | "; echo "Worth | "; echo "
$stock | "; echo "$qty | "; echo "$price | "; if (preg_match("/(\+)/", $chgp[1], $extra)) { echo "";
echo "$change $changep | ";
}
else
{
echo "";
echo "$change $changep | ";
}
echo ""; data($stock); echo" | "; if (strlen($price)==12) echo "$worth.00 | "; else echo "N/A | "; echo "
";
?>
STOCK DATA RETRIEVED FROM
YAHOO! FINANCE