Hey Christopher:

> function CharacterHandler($Parser, $Line, $StockStuff) {
>  array_push($StockStuff, $Line);
>  print "$Line<br>\n";
>  }
... snip ...
> while ( list(,$Sym) = each($Symbols) ) {
>  global $StockStuff;

Global is used INSIDE functions to allow variables to be brought in and
out of the function.  So, in this case, you'd have to put it as the
first line inside the CharacterHandler function.


>  print "1st Position in the array = $StockStuff[1]<br>\n";
... snip ...
> Christopher J. Crane
> Network Operations Manager
> IKON Office Solutions

"1" is not the first position in an array.  "0" is. Considering that
last step there and the signature below, I bet once you get the test
working, you're just going to grab the array index number that has the
latest stock quote in it put it on your company's website.

If that's the case, you've got a problem.  What if NASDAQ changes the
order that the fields are in?  That's right, you'll be putting the wrong
data on the website.  You need to use an associative array, which means 
the array's index are words, and in this case, the words are the names 
of the data tags.

I just whipped up a complete, basic, example of how to parse XML files
using PHP.  Lucky for you, it uses your stock quote project as the
model!  Go check it out:

   http://www.analysisandsolutions.com/code/phpxml.htm

Enjoy,

--Dan

-- 
               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to