Jump to content

quantumdecipher

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

quantumdecipher's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks for the reply. Basically, I looped to 40 to create 40 columns automatically, since there will be many kinds of port, not only 238. What I want for the script to do is dynamically create 40 columns (or any number which I may define later), then connect to the database "orderstatus", open the table "superdome", then fetch all entries with portNumber LIKE 238, parse the portNumber (because the data in the Entry will be in a pattern 238-10, etc), get the digits after the dash, then highlight all the column numbers with returned values and those without values stay in white.
  2. So I'll explain the code I want in the best possible way. I have 40 physical stations, all with pillars. Also I have an existing database of all the units connected to each station. Now I want all those with database records to be highlighted. And those without will be left white.
  3. Thanks for the reply. 1. Only 40 rows returned but not all are in database. Those 40 rows constitute 40 stations. The stored data in the DB are less than 40. So the program actually fetches only those with data. 2. The view source is normal, just that the values are not returned properly. 3. highlightRow() is being called. And I need it since its the function which changes the color of the station which is flagged.
  4. Hi guys, I have this code which fetches data from an existing database and reflects the data into a tabular form. Basically what it does is it parses the field portNumber from my table and gets the last two digits of the variable. Then it will highlight in the table all those returned values for portNumber. Here is the code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Location Mapper</title> <script> function highlightRow(id) { document.getElementById(id).style.backgroundColor = "FFCC00"; } </script> <style> body { font-family:Tahoma, Geneva, sans-serif; font-size:10px; text-align:center; } .unitHere { color:#000; background-color:#0F0; styl } </style> </head> <body> <table width="800" border="1" align="center" cellpadding="0" cellspacing="0"> <tr> <th colspan="40" scope="col">SCMST 238</th> </tr> <tr> <?php $conn = mysql_connect("localhost", "root", "123456") or die(mysql_error()); mysql_select_db("orderstatus") or die(mysql_error()); $sql = mysql_query("SELECT * FROM superdome WHERE portNumber LIKE '%238%' AND isHistory='0' ORDER BY portNumber ASC") or die(mysql_error()); if(mysql_num_rows($sql) == 0) { echo "NOTHING FOUND"; } else { $i = 1; while ($i <= 40) { $x = 0; while($result = mysql_fetch_array($sql)) { $resultPortArray = str_split($result['portNumber'],4); $resultPortArray[1]; $x++; } if ($resultPortArray[1] == $i) { echo "<td width=\"20\" height=\"30\" id=\"".$i."\" class=\"unitHere\">".$i."</td>"; $i++; } else { echo "<td width=\"20\" height=\"30\" id=\"".$i."\">".$i."</td>"; $i++; } } } ?> </tr> </table> </body> </html> The problem is my output only highlights the one column in the array returned. The rest are not highlighted. I need help badly.
  5. Hi guys, I am making a simple program which fetches an array of variables on my table. Basically, I want to map the location of a unit which is plugged into a certain location. The layout consists of 40 locations. I'll be representing them using tables. Lets say I have a table with 1 row and 40 columns which portrays the 40 locations. Lets say, collectively all 40 locations are on Area 238. So each location is labeled 238-1 ... 238-40). In my database I have a field called portNumber which has a value of say 238-11. Now I want the code to check all those data entries with the portNumber LIKE 238, and highlight all rows which return a value. Those without value will remain white. Also the highlighted values should check is the field isHistory is set to 0 otherwise, it won't return the value. Here's the code I did so far: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Location Mapper</title> </head> <body> <table width="800" border="1" align="center" cellpadding="0" cellspacing="0"> <tr> <th colspan="40" scope="col">SCMST 238</th> </tr> <tr> <?php $conn = mysql_connect("localhost", "root", "123456") or die(mysql_error()); mysql_select_db("orderstatus") or die(mysql_error()); $sql = mysql_query("SELECT * FROM superdome WHERE portNumber LIKE '%238%' AND isHistory='0' ORDER BY portNumber ASC") or die(mysql_error()); if(mysql_num_rows($sql) != 0) { echo " <td width=\"20\" height=\"30\" scope=\"row\"> </th> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> <td width=\"20\"> </td> "; } ?> </tr> </table> </body> </html> So if the query for mysql_num_rows return 0, nothing should be highlighted as shown in the picture: but if the query for mysql_num_rows return a value, all values in the array should be highlighted as shown: Location 5 and 40 are highlighted. Really need help on this one... Thanks!
  6. How to fetch the date in the code i posted after the BO_TRAN String Basically I need to get this part: <td style=white-space:nowrap colspan=1><font face="verdana, arial, helvetica" size="-2">2011-05-12 08:43:57 SGT</font> and store the date (2011-05-12 08:43:57 SGT) into a variable. So basically, I need to find the tag where the innerHTML BO_TRAN is located and then store the date from below it to a variable.
  7. Hi guys, I am trying to do a script which fetches the source code of a webpage, say : http://www.abc.com/shop.html, then looks for an element in the source code, say BO_TRAN in the following: tr align=left bgcolor="#F5F5DC"> <td valign=top colspan=1><font face="verdana, arial, helvetica" size="-2">BO_TRAN</font> </td> <td valign=top colspan=1><font face="verdana, arial, helvetica" size="-2">Loader</font> </td> <td valign=top colspan=1><font face="verdana, arial, helvetica" size="-2">n/a</font> </td> <td valign=top colspan=1><font face="verdana, arial, helvetica" size="-2">Batchprocess</font> </td> <td valign=top colspan=1><font face="verdana, arial, helvetica" size="-2">n/a</font> </td> <td style=white-space:nowrap colspan=1><font face="verdana, arial, helvetica" size="-2">2011-05-12 08:43:57 SGT</font> </td> </tr> then returns the value of the date as a variable.
  8. thank you, will definitely try this. I am quit new to this.
  9. Thanks for the Reply, but it still doesn't work. What I am trying to do is, say i got a page, index.html, then i got another page content.html. I have an iframe in index.html which contains content.html. i also have a button in index.html which when clicked needs to return an id from a tag inside content.html. I am trying to make a script which gets the innerHTML of a tag with the id provided by the user inside content.html.
  10. I have a small project, which needs to read a status from an online page. Basically, I need a script to search for a certain tag ID from say www.foo.com/page1.html What I intend to do is get the ID of a certain tag and then save the inner HTML of it into a variable. Any ideas? I tried loading the page in an iFrame and trying JS to get an ID but fails. This is what i tried. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript"> function getContentFromIframe(iFrameName) { var myIFrame = document.getElementById(iFrameName); var content = myIFrame.contentWindow.document.body.innerHTML; var status = content.getElementById('AREA:222_4'); alert(status); } </script> </head> <body> <iframe id="emap" src="http://emaplin3.foo.com/page1.html"> </iframe> <input type="button" value="Get Status" onclick="Javascript: getContentFromIframe('emap')" /> </body> </html> Now I'm lost.
  11. I have a small project, which needs to read a status from an online page. Basically, I need a script to search for a certain tag ID from say www.foo.com/page1.html What I intend to do is get the ID of a certain tag and then save the inner HTML of it into a variable. Any ideas? I tried loading the page in an iFrame and trying JS to get an ID but fails. This is what i tried. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript"> function getContentFromIframe(iFrameName) { var myIFrame = document.getElementById(iFrameName); var content = myIFrame.contentWindow.document.body.innerHTML; var status = content.getElementById('AREA:222_4'); alert(status); } </script> </head> <body> <iframe id="emap" src="http://emaplin3.foo.com/page1.html"> </iframe> <input type="button" value="Get Status" onclick="Javascript: getContentFromIframe('emap')" /> </body> </html> Now I'm lost.
  12. Thanks for the reply, I figured it out already
×
×
  • 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.