Jump to content

Belleanme

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Belleanme's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am trying to delete this second entry...
  2. A client requested a stock ticker on his site. I found this code, which works fine: <?php ///// Replace with Yahoo Finance stock quotes of your choice ////// $raw_stock_data = array('AAPL 200 205', 'BIDU 500 510','RIMM 150 155', 'SNDK 70 72', 'GOOG 500 510','MSFT 30 32','AMD 9 10'); sort($raw_stock_data); ////////////////////////////////////////////////////////////////////////// ?> <div align="center"> <marquee bgcolor="#e0e1e1" direction="left" loop="20" width="100%%"> <?php foreach ($raw_stock_data as $value) { $results = explode(' ',$value); $ticker = $results[0]; $buy = $results[1]; $sell = $results[2]; echo "<font color=\"#ffffff\">$ticker </font>"; echo "<font color=\"#00ff00\">$buy </font>"; echo "<font color=\"#ff0000\">$sell </font>"; echo " "; } ?> Now, I need to get it to feed live data from the free Yahoo stock info online. I looked for days and finally found this code: <?php // Code by: Don Wilson // Edited: October 24, 2003 class stock { function getLastTrade($symbol) { $file = fopen("http://quote.yahoo.com/d/quotes.csv?s={$symbol}&f=sl1d1t1c1ohgv&e=.csv", "r"); $read = fread($file, 2000); fclose($file); $read = str_replace(""", "", $read); $read = explode(",", $read); return $read[1]; } function getChange($symbol) { $file = fopen("http://quote.yahoo.com/d/quotes.csv?s={$symbol}&f=sl1d1t1c1ohgv&e=.csv", "r"); $read = fread($file, 2000); fclose($file); $read = str_replace(""", "", $read); $read = explode(",", $read); return $read[4]; } function getDateClosed($symbol) { $file = fopen("http://quote.yahoo.com/d/quotes.csv?s={$symbol}&f=sl1d1t1c1ohgv&e=.csv", "r"); $read = fread($file, 2000); fclose($file); $read = str_replace(""", "", $read); $read = explode(",", $read); return $read[2] . " " . $read[3]; } } $stock = new Stock(); echo "<pre>\n"; if(isset($symbols)) { $symbols = explode(",", $symbols); foreach($symbols as $symbol) { $change = $stock->getChange($symbol); if($change < 0) $change = "<font color=red>{$change}</font>"; elseif($change > 0) $change = "<font color=green>{$change}</font>"; else $change = "0.00"; echo "Symbol: " . $symbol . "\n"; echo "Last Trade: " . $stock->getLastTrade($symbol) . "\n"; echo "Change: " . $change . "\n"; echo "Date Closed: " . $stock->getDateClosed($symbol) . "\n"; echo "\n"; } } echo "</pre>\n"; ?> ...that a nice person kindly shared. I need to integrate the two. What the client wants is just basic stocks, (the ones there listed are fine) and the high and low amount for the day. Can someone please help? I'd be so appreciative!
  3. Thank you guys SO much! I'll look at this and try it out and let you know how it goes!
  4. Hi guys, if this is only for pros then you're gonna kick me out of here. I just came from a CSS site asking them this question and was informed that this was PHP..so that's how dumb I am. :-\ I design websites, flash websites and some Dreamweaver and Wordpress stuff. someone asked me to do some basic updates on their website, and the site is done in CSS...and PHP... For the moment, the main question is this: There is a document which is called "rotating.specials", in there, the script tells it to show a different special each day. She wanted this removed. The date is part of this script. She wants the date to stay. So! Here is the current script: <?php $today= date("l"); //echo $today; switch ($today) { case "Monday" : echo $today . "'s Special" . '<font color="#FF9933"> 25% off </font> Services<br> Senior Citizens & College Students'; break; case "Tuesday" : echo $today . "'s Special" .'<font color="#FF9933"> 20% off </font> Services<br> Restraunt & Grocery Employees'; break; case "Wednesday" : echo $today . "'s Special" .'<font color="FF9933"> 20% off </font> Services <br>Police & Fire Dept. Employees'; break; case "Thursday" : echo $today . "'s Special" .'<font color="FF9933"> 20% off </font> Services<br>Hospital & Medical Employees'; break; case "Friday" : echo $today . "'s Special" .'<font color="FF9933"> 20% off </font> Services<br> City & County Employees'; break; default : echo 'Militay Special <font color="#FF9933">25% off</font> Services<br> every Monday - Friday! '; break; } ?> Can you please tell me how to modify this to only show the current date? I appreciate your help very much! Thanks!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.