Jump to content

eatc7402

Members
  • Posts

    36
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

eatc7402's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi to all! My name is David and I just turned 70 years of age. I started programming in 1972 on a Bendix G15 vacuum tube computer with punched paper tape and an IBM Selectric typerighter as I/O devices. I was a Senior Software Engineer for the 3M Company for 25 years (now retired). I also have been a firefighter for 35 years. http://www.extraalarm.org I have been a PHP for many years. David eatc7402
  2. I'm using Win 8, php 5.3.13 on a new pc for the first time. The following simple if test should return EITHER of the choices (or so I do beleive) But when I run it on my new Windiows 8 PC for the first time it does neither. Strange! The line echo "$info_test_file<br><br>" ; does return a correct result but the if test doesn't seem to. ================================ <?php echo "test<br><br>" ; $info_test_file ="../php/info_test.txt" ; echo "$info_test_file<br><br>" ; if (file_exists($info_test_file)) { echo "<font color=\"#FFFFFF\">File test DOES exist!</font><br />" ; $we_are_local = "1" ; } else { echo "<font color=\"#FFFFFF\">File test DOES NOT exist!</font><br />" ; } ?> ========================= eatc7402
  3. Well I found a php function to strip out and remove whitespace and special character, and then using strlen and strreplaece from the then know positions seems to br getting me closer to my desired outcome. The regular expression function given in a reply DID not do what I desired which was a TEXT SUBSTITUION. eact7402
  4. I have a number of records of the html sections of a series of Google Earth placemarks that I managed to extract from the raw kml file. The purpose of the exersize was to then use the simplehtmldom.php api to extract the DATA from the raw html code. Some of the process is going well... and some is NOT. I have found that if I modify the raw html code by entering ID attributes into the html code the simplehtmldom api has an easy time identifying the desired data, and the data can be far 'cleaner' by entering an id attribute as 'close' to the data as possible. But doing a php text search and replace often requires finding a 'unique' identifyable portion of the html code and THEN placing the 'id' attribute in a nearby html tag because the desired data is nested inside a non-unique tag. As in I can identify a SPECIFIC <td> tag section where the data i desire is located but the data is nested inside a <font> tag inside the <td> cluster. Hence my problem... If I do a search in the following code... <td><b><font size="+2" color="#FF0000">Neighborhood:</font> <font size="+2" color="#0000FF">City of Sidney</font></b></td> I can locate the 'Neighborhood:' string because it is unique in the whole html code. Then by some charcter counting I am desiring to put my 'id' attribute in the NEXT font tag because it surrounds the desired data the 'City of Sidney'... as in... <td><b><font size="+2" color="#FF0000">Neighborhood:</font> <font id="neighborhood" size="+2" color="#0000FF">City of Sidney</font></b></td> With this modification the desired data is easily found and cleanly produced. But the html code while all operating correctly in a web page is not all identicle from a 'whitespace' point of view AND thus my problem. If I search the following code... <td> <b><font size="+2" color="#FF0000">Neighboorhood:</font> <font size="+2" color="#0000FF">Greenacre</font></b> </td> While being identical as far as html is concerned if I search this code for the 'Neighboorhood:' identifier I find it... but then attempting to place the id tag into the NEXT font tag is being problematic. What i seem to need is a function that once the 'Neighboorhood:' string position is identied and noted in the whole of the html code, to FIND and modify the NEXT occurance of a font tag no matter what whitespace (or special charachters) may be occuring. Any suggestions?? eatc7402
  5. I altered my code and when I called the function WITHOUT a file path like this... $html = file_get_html("table_data.txt"); it no longer complains about any missing arg. So... what is the required arg if I want to fully specify the path to the file?? eatc7402
  6. Ahhh yes.. an EQUAL sign... that fixed that error.. but NOW I get this... Warning: file_get_contents(C:\eaahmpg\eatc7402\www\stations\Sydney\code able_data.txt) [function.file-get-contents]: failed to open stream: Invalid argument in C:\eaahmpg\eatc7402\www\php\simplehtmldom\simple_html_dom.php on line 39 An argument? What does it need here.. if I give it an empty argument is complains also. $html = file_get_html("C:\eaahmpg\eatc7402\www\stations\Sydney\code\table_data.txt", ""); eatc7402
  7. I am a new simplehtmldom user. It is working and the php api loads, and I can parse when I lod data from a string. But if I attemp yo load data from a file like this... $html->file_get_html("C:\eaahmpg\eatc7402\www\stations\Sydney\code\table_data.txt"); I receive the following error. Fatal error: Call to undefined method simple_html_dom::file_get_html() in... Hmmm. The function IS defined in the api. I'm not sure where I'M going wrong here. eac7402
  8. What exactly am I trying to do?? I want to find a way to ensure that even if the user has the html page chache turned ON, that they will get a REFRESHED copy of a particular html page EACH time they view it, so they do not MISS updates. eatc7402
  9. Well this ALMOST seems to work. If I force the page to go to a DIFFERENT url than the one I'm already on, it works. But, I don't want to go to another page, I simply want to force a REFRESH of the one I'm already on. So, turning the new url into the page I'm already on causes a LOOP of refreshes that continues forever. I tried to add an exit statement but that did not seem to fix it. Also somethings wrong with the syntax, as I see a "; ?> on the screen which are the last 5 characters of the echo command not being properly recognized. Hummm. eatc7402
  10. I am sorry, but I don't understand what you are telling me. What does PgDn have to do with REFRESH?? eatc7402
  11. I have an html page that gets updated about once a week. I would like to FORCE the browser (IE, Firefox, Netscape, or Opera) to REFRESH when the user opens the page to ensure they receive the latest update. Been searching around for some php code to add to the page to accomplish this without success. Can anyone give me a steer to how to accomplish this. Thanks. Dave, eatc7402
  12. Yup, I thought about number 1 I'll have to figure out which field (or fields) the user desires, and run the appropriate query based on that. I can do that in my php script beforehand. It seems to me that all this would almost be a 'non-issue' if I could use a subquery selecting primary keys, so suggestion number 2, upgrading to a newer version of MySql would be a better choice. Unfortunately that is not up to me, as the server is provided by our website ASP. But I can always try to convince them. eatc7402
  13. To aritcus... Nicely done... That works fine (I tested it), when the users search is from the BOTTOM of the hierarchy upward. But when the user might search on a field in a TOP DOWN manner they will get multiple rows returned for each primary key. Bottom up, lets you get three rows for a fire when searching by Engine number. But searching the same fire by address (which is TOP DOWN) it returns NINE rows using the query articus suggested. My users will be able to choose from ANY field, at any level, and mix them to search by. I have to return all the rows for an individual fire, no matter what field, or what level, the user chooses to search by. Would I get anywhere to create a FLAT table of all data where most all rows would contain the top level data (including pri keys), and those same rows would be partially filled by those fields coming from lower level tables? eatc702
  14. Thats why in a previous reply I stated that I relized that GROUP BY 'reduces' the query to ONE ROW per query. That is what I have already (before using a GROUP BY) have. What I need is an.. EXPAND BY but such a construct does not exist, exactly. That is where the discussion about sub queries on primary keys ensued. As I have mentioned my version of MySql does not support sub queries. I need a two step process. Step 1. run a query to gather the subset of required primary keys. Step 2. run a second query using the list of primary keys gathered in step one as the selectors in the WHERE clause That will return ALL the rows of the main table, AND the subtable with ALL the rows that 'belong' to a single fire incident. as in...(This is what I WANT).... Pri_key Address Date Alarm Time Engines Ladders ------------------------------------------------------------------------------------------ 200 123 Some St. 2/11/2005 1st Alarm 1205 6-14-21 6-9 200 123 Some St. 2/11/2005 2nd Alarm 1209 19-11 3 200 123 Some St. 2/11/2005 3rd Alarm 1213 8-7 4 This is what I am getting.... 200 123 Some St. 2/11/2005 2nd Alarm 1209 19-11 3 Because the search for a fire that Engine 11 responded to is kept in a SUBTABLE (on the MANY side of the join), and hence returns only one of the three rows that pertain to this one fire. So, I then need to take the primary kee returned (then 200 key), and do another query with it as the seector in the WHERE clause to return ALL THREE ROWS that actually have the 200 value as their key. Hence the need for not a GROUP BY, but rather the equivalent of an EXPAND BY. Therefor the suggestion of using a WHERE main_table.primary_key IN('a list of keys') Where the list of keys gets returned by Step 1 (above). I hope that explains it. I have two tables A main table (with primary keys) and a subtable joined to the main table in a ONE (the main table) to MANY (the subtable). However searches for fields located in the subtable return a subset of the rows that actually contain the same primary key, because I seem to be not findinf these fields by going through the full relationship created by the one-to-many join. eatc7402
  15. Okay, first thanks for the suggestion about using the special formmat for code sections. Yes, I just tried the WHERE 'primary_key' IN ('20', '68', '40') and that works nicely and 'possibly' removes the need for looping. But I wonder how large the IN clause can be. There may be cases where there may be 10,000 primary keys to search. The data we are searching are all the major fires in Minneapolis, and St. Paul from 1911 to 2007 (today). There is a lot of data. A hundred (or more) major fires each year for nearly a hundred years, for each city, presents a lot of keys. Thus my question on how many items can be fit into one IN clause. The keys may be need to be broken into subsets, and several queries with IN clauses run, if there is a limit as to how many entries arec allowed. ?? eatc7402 p.s. I will provide another message describing how the table are related again using the 'code' styler. But it's late tonite here....
×
×
  • 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.