473,396 Members | 1,809 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Getting PHP veribles from CSV

Victor White
I'm trying to output verbless from a CSV file into PHP. The PHP file is logs from the UPS management software, thus I'm only interested in the last line.

To date, I can get the last line number to be output and I can putout the array of data. But I can't seem to link the last line to verbless.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. //$filename = "c:/Program Files/MonitorSoftware/UPSDATA.CSV";
  3. $filename = "UPSDATA.CSV";
  4. $lines = file($filename);
  5. $linecount = (count($lines)-1);
  6.  
  7. echo $filename ; echo '<br />';
  8. echo $linecount ; echo '<br />';
  9.  
  10.  
  11. echo '<br />';
  12.  
  13. $file = new SplFileObject($filename);
  14. $file->setFlags(SplFileObject::READ_CSV);
  15. foreach ($file as $row) {
  16.     list($date, $time, $port, $type, $uk1, $InV, $uk2, $uk2, $OutV, $uk4, $uk5, $uk6, $OutH, $load, $temp ) = $row;
  17.     printf(" $date $time   $InV V - $OutV V $OutH Hz      load - $load     Temp - $temp"); echo '<br />';
  18. }
  19.  
  20. //What I want...
  21.  
  22. echo $date ; echo ''; echo '<br />';
  23. echo $time ; echo ''; echo '<br />';
  24. echo $InV ; echo 'V'; echo '<br />';
  25. echo $OutV ; echo 'V'; echo '<br />';
  26. echo $OutH ; echo 'Hz'; echo '<br />';
  27. echo $load ; echo '%'; echo '<br />';
  28. echo $temp ; echo 'ºC'; echo '<br />';
  29. ?>
  30.  
  31.  
Apr 3 '11 #1
0 1003

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Eyal | last post by:
Hey, I would appriciate if anyone can help on this one: I have a java object/inteface having a method with a boolean parameter. As I'm trying to call this method from a javascript it fails on...
5
by: Francis Bell | last post by:
I just found that my fin stream is not getting passed to my readInASpinnerbait function. Here's what I have: string readInFirstChars(ifstream &fin) { char first; string print; while...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
0
by: Si | last post by:
I'm writing an HttpModule to intecept web method calls and retrieve custom authentication information from their SOAP headers. I have the httpModules tag in web.config and that appears to be...
3
by: dei3cmix | last post by:
Hey, I am having a problem with a program I am working on. Basically, the first part of the program gets input from a file using cin.getline. Then the second part, (still in the same main as the...
32
by: paul | last post by:
HI! I keep on getting this error and I have tried different things but I am not sure how to send the expiring date. The error that I am getting in Firefox 1.5 is "Error: expires.toGMTString is...
2
by: MSK | last post by:
Hi, Continued to my earlier post regaring "Breakpoints are not getting hit" , I have comeup with more input this time.. Kindly give me some idea. I am a newbie to .NET, recently I installed...
4
by: R.Manikandan | last post by:
Hi In my code, one string variable is subjected to contain more amount of characters. If it cross certain limit, the string content in the varabile is automatically getting truncated and i am...
4
by: imaloner | last post by:
I am posting two threads because I have two different problems, but both have the same background information. Common Background Information: I am trying to rebuild code for a working,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.