Jump to content

KenHorse

Members
  • Content Count

    23
  • Joined

  • Last visited

Community Reputation

0 Neutral

About KenHorse

  • Rank
    Member
  1. Mon Aug 24, 2020 2:41 pm I'm using php_serial.class.php, called once require_once("php_serial.class.php"); and call it $serial: $serial = new phpSerial; The above are in a global.php file that sets up the serial com parameters. In another file, I include global.php that contains my other code to send and read from the class In a function, I pass the class: Function checkInput($serial){ And one in the Function: $read = $serial->readPort(); This throws an error: "PHP Fatal error: Uncaught Error: Call to a member function readPort() on string" If I do the $read outside of the Function, it doesn't throw the error so I assume I'm doing something wrong passing the class to the function?
  2. Disregard, problem resolved. Sorry for the spam
  3. I am reading in a table and ordering it by a column labeled "sub" and generating an HTML table. The "sub" column entries are in numerical order (i.e. 1 2 3 4 5 6 7 8 10 11 12 etc. etc.). There are over 100 entries in this table as well. The problem I'm facing is probably obvious to some of you as the display is 1 10 100 101 102 103 105 11 12 13 14 15 16 17 18 19 2 20 and so on... Obviously I'd like the display to be in numerical order. What can I do?
  4. I am reading in a table and ordering it by a column labeled "sub" and generating an HTML table. The "sub" column entries are in numerical order (i.e. 1 2 3 4 5 6 7 8 10 11 12 etc. etc.). There are over 100 entries in this table as well. The problem I'm facing is probably obvious to some of you as the display is 1 10 100 101 102 103 105 11 12 13 14 15 16 17 18 19 2 20 and so on... Obviously I'd like the display to be in numerical order. What can I do?
  5. Thanks. It sees them now (Not a big deal to replace the () with [] after all....)
  6. I have a Windows-style ini file that contains entries as such: [Timers] Timer(1)=50 Timer(2)=30 Timer(3)=20 The entries represent an array of 3 different timers Apparently parse_ini_file can't deal with the () format. Is there any way to use this format ini file without having to change how arrays are designated?
  7. Consider the following snippet: print " <td align=\"center\">"; if($row[changed]){print "<B><RED>";} print "<a href=\"editmacrorc.php?id=$row[id]&port=$port&tab=$tab\">"; The tag <RED> is a CSS entry that works fine in other code I use: RED {color:red} As you may see, we read in data from a MySQL database and if the 'changed' field contains a '1', we want to make the displayed character bolded and also RED. And if that character is clicked, take us to the new php file (that all works fine). But only the BOLD is displayed but it is not in RED. Not really sure if this an HTML or PHP issue but help! :D
  8. Well, I've tried all sorts of things and nothing works as expected. Guess I'll just have to leave things alone and format them as needed later on
  9. I'm trying to make his tables a little more consistent. Attached is a screen shot of how the page is displayed (I only show the first 3 entries but there are 105 total) These are the relevant lines from the table (copied & pasted from the .sql file) ------------------------------------------------------------------------------------------------------------------------------------------ INSERT INTO `config` (`command`, `port`, `sub`, `cdata`, `description`, `type`, `changed`, `comment`, `id`, `help`, `defaultdata`, `tab`, `inputspec`, `specalt`, `prompt`, `maxsize`) VALUES ('*205001', 0, NULL, '10901', 'Macro 1 recall', 'code', 0, '', 309, NULL, '10901', 'macrorecall', NULL, NULL, NULL, 8 ), ('*205002', 0, NULL, '10902', 'Macro 2 recall', 'code', 0, '', 145, NULL, '10902', 'macrorecall', NULL, NULL, NULL, 8 ), ('*205003', 0, NULL, '10903', 'Macro 3 recall', 'code', 0, '', 146, NULL, '10903', 'macrorecall', NULL, NULL, NULL, 8 ), ('*4002', 0, '01', '228 070 102 152 116 117 ', 'Macro 1', 'Macro', 0, '', 233, NULL, NULL, NULL, NULL, NULL, NULL, NULL), ('*4002', 0, '02', '210 123 027 ', 'Macro 2', 'Macro', 0, '', 290, 'Up to 15 three digit function numbers. Hint: click lookup function numbers are automaticly added', NULL, NULL, NULL, NULL, NULL, NULL), ('*4002', 0, '03', '211 119 ', 'Macro 3', 'Macro', 0, '', 200, NULL, NULL, NULL, NULL, NULL, NULL, NULL), ('*4005', 0, '01', '123', 'Macro 1 Port Limit', 'prog', 0, '', 677, '', '123', '', '1;2;3;12;13;23;123', '1;2;3;1 and 2;1 and 3;2 and 3;1, 2, and 3', 'Ports:', NULL), ('*4005', 0, '02', '123', 'Macro 2 Port Limit', 'prog', 0, '', 678, '', '123', '', '1;2;3;12;13;23;123', '1;2;3;1 and 2;1 and 3;2 and 3;1, 2, and 3', 'Ports:', NULL), ('*4005', 0, '03', '123', 'Macro 3 Port Limit', 'prog', 0, '', 679, '', '123', '', '1;2;3;12;13;23;123', '1;2;3;1 and 2;1 and 3;2 and 3;1, 2, and 3', 'Ports:', NULL), ------------------------------------------------------------------------------------------------------ Notice in the first group of 3 (starting with *205001, etc). I wanted to change the format of those entries to be more in line with with the other two groups where the 'command' entry is simply *2050 and the sub entry would be 01, 02. etc. Follow? Of course when I make that change to the table (as follows) ('*2050', 0, '01', '10901', 'Macro 1 recall', 'code', 0, '', 309, NULL, '10901', 'macrorecall', NULL, NULL, NULL, 8 ), ('*2050', 0, '02', '10902', 'Macro 2 recall', 'code', 0, '', 145, NULL, '10902', 'macrorecall', NULL, NULL, NULL, 8 ), ('*2050', 0, '03', '10903', 'Macro 3 recall', 'code', 0, '', 146, NULL, '10903', 'macrorecall', NULL, NULL, NULL, 8 ), The 2nd attachment is what is displayed As I said, I'm kind of a newbie at this and I appreciate the help. Let me know if you need anything else (if you're wondering why I want to change the table, this stuff is processed later and it would be much easier if the format was consistent)
  10. I'm taking over existing code from someone else but I am kind of a newbie with MySQL. Poking around the 'net I found some references to the following using aliases? One of the php files calls a database table named "config" and loads a webpage with the info. select m.sub, m.cdata, m.description, m.comment, m.tab, m.id, p.cdata as ports, cd.cdata as code, m.changed as changed from config m, config p, config cd where m.command = '*4002' and m.sub=p.sub and cd.command = CONCAT('*2050',m.sub) and p.command = '*4005' order by m.command"; I'm trying to understand exactly what it does because I'm trying to change how the table it reads is formatted and I'm kinda shooting in the dark.
  11. Thanks all who responded and especially requinix and gizmola. Both of these solutions worked (or perhaps I should say either of them do).
  12. The file contains 4,096 lines, each one representing 1 byte of data in the EEPROM of an embedded processor. The format of the file is the memory location in decimal, a comma and the value of that EEPROM location. The actual locations of the 4 bytes in question are below but that really shouldn't matter to this issue 283,0 284,0 285,220 286,66
  13. Sorry, yes..the value in those bytes should represent 110.0 (sorry, somewhat new to PHP and I inherited a file that I'm working my way though. Obviously I missed a few things along the way.... Those 4 bytes are actually read in - line by line - from a file. This file contains roughly 4,000 lines and format is: 1,0 2,0 3,220 4,66 So and so forth... Here is how I'm reading (and processing) this file <?php $myfile = fopen("myfile.dat", "r") or die("Unable to open file!"); while(!feof($myfile)) { $indata = fgets($myfile); $position = strpos($indata,","); $buffer1 = intval(trim(substr($indata, $position + 1))); $indata = fgets($myfile); $position = strpos($indata,","); $buffer2 = intval(trim(substr($indata, $position + 1))); $indata = fgets($myfile); $position = strpos($indata,","); $buffer3 = intval(trim(substr($indata, $position + 1))); $indata = fgets($myfile); $position = strpos($indata,","); $buffer4 = intval(trim(substr($indata, $position + 1))); } ?>
  14. Take the following 4 bytes, stored in the order shown: 0, 0, 220, 66 The above bytes represent the number 11000, stored as (from the compiler I use for embedded processor work) as a "single", which they define as a "signed 32 bit binary number". I take that to be the same as a float? How can I convert these 4 bytes to their actual value of 11000? (I've tried pack with no success)
×
×
  • 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.