Hey thank Dan, I will try this. Does List waste lots of time and memory? Normally, I create a function and global a bunch of variables to be used later on the HTML/PHP file. After I global the variables I split the string using the List function. I do that for stock quotes from YAHOO so I can code the layout in like Dreamweaver and place the varaibles where I would like instead of the function writing out the html for me. Is that bad?
"Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Thu, Jul 18, 2002 at 10:14:25AM -0400, Chris Crane wrote: > > > Warning: Undefined offset: 5 in > > Means your array doesn't have that key in it. I bet you're running into > blank lines in your file. > > > > $Results = implode('', file("$LookupURL")); > > $Data = explode("\n", $Results); > > Uh, you do realize that you're flip flopping the data around here for no > reason. file() already creates an array. But you go through the > unnecessary steps of compressing that array into a string and then > recreating a new array. Just do this: > > $Data = file($LookupURL); > > That will eliminate your errors by not adding extra blank lines. > > > > foreach($Data as $Line) { > > list($H_Date, $H_Open, $H_High, $H_Low, $H_Close, $H_Volume) = split(",", > > $Line); > > print "<tr bgcolor=\"#FFFFFF\"> > > <td>$H_Date</td>\n<td>$H_Open</td>\n<td>$H_High</td>\n<td>$H_Low</td>\n<td>$ > > H_Close</td>\n<td>$H_Volume</td>\n</tr>"; > > } > > But, your whole approach is wasteful. As I said yesterday, use fopen() > and then fgetcsv(). Forget the file() and split() calls. > > Then, you're wasting time and memory with the list(). Use the resulting > array directly. > > while ( $Line = fgetcsv($fp, 500) ) { > echo "<tr> <td>$Line[0]</td> <td>$Line[1]</td> ... etc ..."; > } > > Or, since you're pringing everything out, you could just do this: > > while ( $Line = fgetcsv($fp, 500) ) { > echo '<tr><td>' . implode('</td><td>', $Line) . '</td></tr>' > } > > --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