Jump to content

usmarinenco

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Everything posted by usmarinenco

  1. This ended up being the final code....just in case anyone is ever looking for this type of thing again. <!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"> <meta content="en-us" http-equiv="Content-Language" /> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Removed Service Desk</title> <style type="text/css"> .auto-style2 { font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif; font-size: x-large; } .auto-style3 { text-align: center; color: #FF0000; } .auto-style4 { font-family: Arial, Helvetica, sans-serif; } .auto-style5 { text-align: center; } </style> </head> <script type="text/javascript"> <!-- function FP_swapImg() {//v1.0 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length; n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm; elm.$src=elm.src; elm.src=args[n+1]; } } } function FP_preloadImgs() {//v1.0 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array(); for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; } } function FP_getObjectByID(id,o) {//v1.0 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id); else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el; if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c) for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; } f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements; for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } } return null; } // --> </script> <body background="bg.ltr.jpg" onload="FP_preloadImgs(/*url*/'button5.jpg',/*url*/'button6.jpg')"> <div class="auto-style5"> <img alt="" height="177" longdesc="Removes For Security Reasons" src="DesertDawgLOGO.png" width="165" /> <span class="auto-style2">Removed for Security Reasons - Service Desk Equipment Sign-In</span> <img alt="" height="189" longdesc="25th Signal Battalion" src="bnlogo.png" width="102" /><br /> <br /> <?php $db_host = 'localhost'; $db_user = 'root'; $db_pass = ''; $db_in = new MySQLi( $db_host, $db_user, $db_pass, 'sign_in' ); $db_out = new MySQLi ( $db_host, $db_user, $db_pass, 'sign_out' ); if( $db_in->connect_error || $db_out->connect_error ) trigger_error( 'Unable to initiate database connections', E_USER_ERROR ); // Grab whatever information you need from the tables $q_in = 'SELECT * FROM `customer sign-in`'; $q_out = 'SELECT * FROM `customer sign-out`'; if( ($r_in = $db_in->query($q_in)) === FALSE || ($r_out = $db_out->query($q_out)) === FALSE ) trigger_error( 'Unable to grab ticket information from databases', E_USER_ERROR ); // Initialize the arrays that will hold our data $data_in = array(); $data_out = array(); // Build the in array, using the ticket as the key while( $row = $r_in->fetch_assoc() ) $data_in[ $row['Ticket #'] ] = $row; $r_in->free(); // Build the out array, using the ticket as the key while( $row = $r_out->fetch_assoc() ) $data_out[ $row['Ticket #'] ] = $row; $r_out->free(); // Use array_diff_key() to automatically grab keys that don't exist in out $result = array_diff_key( $data_in, $data_out ); echo "<table border='1'> <tr> <th>Sign In Date</th> <th>Rank/CIV</th> <th>First Name</th> <th>Last Name</th> <th>Unit</th> <th>DSN/Roshan</th> <th>Classifications</th> <th>Serivces Requested</th> <th>Service Tag/ Serial Number</th> <th>Ticket #</th> <th>Make/ Model</th> </tr>"; foreach($result as $row) { { echo "<tr>"; echo "<td>" . $row['Sign in Date'] . "</td>"; echo "<td>" . $row['Rank/CIV'] . "</td>"; echo "<td>" . $row['First Name'] . "</td>"; echo "<td>" . $row['Last Name'] . "</td>"; echo "<td>" . $row['Unit'] . "</td>"; echo "<td>" . $row['DSN/Roshan'] . "</td>"; echo "<td>" . $row['Classifications'] . "</td>"; echo "<td>" . $row['Services Requested'] . "</td>"; echo "<td>" . $row['Service Tag/ Serial Number'] . "</td>"; echo "<td>" . $row['Ticket #'] . "</td>"; echo "<td>" . $row['Make/ Model'] . "</td>"; echo "</tr>"; } } ?> </div> <p class="auto-style3"><strong><span class="auto-style4">Equipment listed below is currently CHECKED IN at the Service Desk</span><br /> <a href="http://removed for security reasons"> <img id="img1" alt="Return to KAF IMO Portal" height="33" onmousedown="FP_swapImg(1,0,/*id*/'img1',/*url*/'button6.jpg')" onmouseout="FP_swapImg(0,0,/*id*/'img1',/*url*/'button4.jpg')" onmouseover="FP_swapImg(1,0,/*id*/'img1',/*url*/'button5.jpg')" onmouseup="FP_swapImg(0,0,/*id*/'img1',/*url*/'button5.jpg')" src="button4.jpg" style="border: 0" width="167" /><!-- MSComment="ibutton" fp-style="fp-btn: Glass Capsule 1" fp-title="Return to KAF IMO Portal" --></a></strong></p> </body> </html>
  2. PFM!!! You're awesome!!!!! That is exactly what I was looking for....I swear....I think every year I get older my 'google skills' get cut in half....I swear I looked for that for at least two days! I really appreciate your patience..... Carl
  3. Per the poster who stated to run the code and then post what I'm getting as results, here is that! This PHP page is loaded: <?php $db_host = 'localhost'; $db_user = 'root'; $db_pass = ''; $db_in = new MySQLi ( $db_host, $db_user, $db_pass, 'sign_in' ); $db_out = new MySQLi( $db_host, $db_user, $db_pass, 'sign_out' ); if( $db_in->connect_error || $db_out->connect_error ) trigger_error( 'Unable to initiate database connections', E_USER_ERROR ); $q_in = 'SELECT * FROM `customer sign-in`'; $q_out = 'SELECT * FROM `customer sign-out`'; if( ($r_in = $db_in->query($q_in)) === FALSE || ($r_out = $db_out->query($q_out)) === FALSE ) trigger_error( 'Unable to grab ticket information from databases', E_USER_ERROR ); $data_in = array(); $data_out = array(); while( $row = $r_in->fetch_assoc() ) $data_in[ $row['Ticket #'] ] = $row; $r_in->free(); while( $row = $r_out->fetch_assoc() ) $data_out[ $row['Ticket #'] ] = $row; $r_out->free(); $result = array_diff_key( $data_in, $data_out ); print_r( $result ); ?> THIS is the result of 'print_r' Array ([DODOIJSDF]=>Array([iD]=>617[sign in Date]=>2011-09-23 00:00:00[RANK/CIV]=>SPC/E4[First Name]=>Sean[Last Name]=>John[unit]=>510th[DSN/Roshan]=>0791110000[Classifications]=>NIPR[service Requested]=>Q-TIP Scan[service Tag/ Serial Number]=>DODOD[Ticket #]=>DODOIJSDF[MAKE/ Model]=>Dell E6500)) I need to find a way to format this data (which is the correct data, given the request of the code above....)....into a table for each record. I've tried the numerous other ways that were posted here to get the results I need to get, yet none of them work with what I am trying to do.
  4. Nothing to be confused about. There is no data being saved IN Access. There is a MySQL ODBC connection to the MySQL database. I'm only using Access as a FRONT END for the FORMs. All data is saved directly to MySQL. Carl
  5. The Ticket # isn't generated in this system. It's generated in Remedy.....
  6. Ahhhh........the question everyone has asked me so far. I do not own the data.....it's government owned and therefore I cannot change the way it's presented to me for review and presentation on the web page I'm trying to create. All of this PHP is foreign to me in the end.....I spent many a hour on this message board to get to where I am now..... The code below just does the array and returns the data in a web page that is very garbled.....if I could just change this to display the data in a 'table' on the page that would be ideal....unfortunately....with what I'm reading above.....I ummm.....feel dumber than I felt before I started this! <?php $db_host = 'localhost'; $db_user = 'root'; $db_pass = ''; $db_in = new MySQLi ( $db_host, $db_user, $db_pass, 'sign_in' ); $db_out = new MySQLi( $db_host, $db_user, $db_pass, 'sign_out' ); if( $db_in->connect_error || $db_out->connect_error ) trigger_error( 'Unable to initiate database connections', E_USER_ERROR ); $q_in = 'SELECT * FROM `customer sign-in`'; $q_out = 'SELECT * FROM `customer sign-out`'; if( ($r_in = $db_in->query($q_in)) === FALSE || ($r_out = $db_out->query($q_out)) === FALSE ) trigger_error( 'Unable to grab ticket information from databases', E_USER_ERROR ); $data_in = array(); $data_out = array(); while( $row = $r_in->fetch_assoc() ) $data_in[ $row['Ticket #'] ] = $row; $r_in->free(); while( $row = $r_out->fetch_assoc() ) $data_out[ $row['Ticket #'] ] = $row; $r_out->free(); $result = array_diff_key( $data_in, $data_out ); print_r( $result ); ?> ]
  7. Thanks to the great help from some great people on this message board I'm right at the finish line on this page. I'm trying to mesh all the coding together at this point, and make it display the information. I keep getting 'mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource....etc..(filename/location) on line 51. Am I way off here??? <?php $db_host = 'localhost'; $db_user = 'root'; $db_pass = ''; $db_in = new MySQLi ( $db_host, $db_user, $db_pass, 'sign_in' ); $db_out = new MySQLi( $db_host, $db_user, $db_pass, 'sign_out' ); if( $db_in->connect_error || $db_out->connect_error ) trigger_error( 'Unable to initiate database connections', E_USER_ERROR ); $q_in = 'SELECT * FROM `customer sign-in`'; $q_out = 'SELECT * FROM `customer sign-out`'; if( ($r_in = $db_in->query($q_in)) === FALSE || ($r_out = $db_out->query($q_out)) === FALSE ) trigger_error( 'Unable to grab ticket information from databases', E_USER_ERROR ); $data_in = array(); $data_out = array(); while( $row = $r_in->fetch_assoc() ) $data_in[ $row['Ticket #'] ] = $row; $r_in->free(); while( $row = $r_out->fetch_assoc() ) $data_out[ $row['Ticket #'] ] = $row; $r_out->free(); $result = array_diff_key( $data_in, $data_out ); echo "<table border='1'> <tr> <th>ID</th> <th>Sign In Date</th> <th>RANK/CIV</th> <th>First Name</th> <th>Last Name</th> <th>Unit</th> <th>DSN/Roshan</th> <th>Classifications</th> <th>Services Requested</th> <th>Service Tag/ Serial Number</th> <th>Ticket #</th> <th>Make/ Model</th> </tr>"; while($row = mysql_fetch_assoc($result)) { // Retrieve data until no more { echo "<tr>"; echo "<td>" . $row['ID'] . "</td>"; echo "<td>" . $row['Sign in Date'] . "</td>"; echo "<td>" . $row['Rank/CIV'] . "</td>"; echo "<td>" . $row['First Name'] . "</td>"; echo "<td>" . $row['Last Name'] . "</td>"; echo "<td>" . $row['Unit'] . "</td>"; echo "<td>" . $row['DSN/Roshan'] . "</td>"; echo "<td>" . $row['Classifications'] . "</td>"; echo "<td>" . $row['Services Requested'] . "</td>"; echo "<td>" . $row['Service Tag/ Serial Number'] . "</td>"; echo "<td>" . $row['Ticket #'] . "</td>"; echo "<td>" . $row['Make/ Model'] . "</td>"; echo "</tr>"; } } ?>
  8. Muddy, The ACCESS side is only for the "FRONT END" that the user inputs their data into. It's that way because military people understand Access....hahaha! The back end is MySQL...all data input into the forms is stored in MySQL. The QUERY I created in ACCESS uses the MySQL databases to pull the data and display the results. I've also created a PHP page with the help of some others that uses an Array out of the DB's to pull together the data I need. Now I just have to format the Array results so that they display on the web page in a grid format....and not the hideous array results format.
  9. Also wanted to add the code you provided worked with a few changes. "ticket' was changed to 'Ticket #'....table names were changed to the correct ones and everything now displays on the PHP page. Now I just gotta format it to display without all the: Array ([444000]=>Array([iD]=>612[sign in Date]...etc...etc...etc.... Thank you again, Carl
  10. Thank you for the above explanation. I cannot change the structure because I am not the information holder. Some of the data ends up on a classified network, but is unclassified in it's present state. I'm not a DBA, nor am I a Web Designer for this company....however my experience in the past has given me a basic understanding of what's required to complete these things.... If I was the information owner, I would have started this entire thing from scratch. The DB's that are setup are that way because when this is complete, the existing data in the DB's the information owner has will be imported into this system.
  11. I have an MS Access Database that resides on the server that I will be hosting the pages I'm building. In my MS Access Database I have a query called "CheckedInEquipment" that I would like to have constantly display on a PHP page. It needs to be 'fluid', so the data is always up to date on the web page. (This is all in a sandbox XAMPP environment). Has anyone done this, can you lead me to examples or push me in the right direction? Carl
  12. If you want to create it in MySQL yourself here is the statement. [uNCLASSIFIED DATA IS ENCLOSED] -- phpMyAdmin SQL Dump -- version 3.1.1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Sep 18, 2011 at 11:13 PM -- Server version: 5.1.30 -- PHP Version: 5.2.8 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `sign_in` -- CREATE DATABASE `sign_in` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; USE `sign_in`; -- -------------------------------------------------------- -- -- Table structure for table `customer sign-in` -- CREATE TABLE IF NOT EXISTS `customer sign-in` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `Sign in Date` datetime NOT NULL, `Rank/CIV` varchar(255) NOT NULL, `First Name` varchar(255) NOT NULL, `Last Name` varchar(255) NOT NULL, `Unit` varchar(255) NOT NULL, `DSN/Roshan` varchar(10) NOT NULL, `Classifications` longtext NOT NULL, `Services Requested` varchar(255) NOT NULL, `Service Tag/ Serial Number` varchar(255) NOT NULL, `Ticket #` varchar(255) NOT NULL, `Make/ Model` varchar(255) NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=614 ; -- -- Dumping data for table `customer sign-in` -- INSERT INTO `customer sign-in` (`ID`, `Sign in Date`, `Rank/CIV`, `First Name`, `Last Name`, `Unit`, `DSN/Roshan`, `Classifications`, `Services Requested`, `Service Tag/ Serial Number`, `Ticket #`, `Make/ Model`) VALUES (612, '2011-09-17 00:00:00', 'CTR', 'Joe', 'Blow', 'Some Unit', '0794911109', 'NIPR', 'BASELINE', 'D4770D1', '444000', ''), (613, '2011-09-18 00:00:00', 'CPL / E-4', 'Bob', 'Jones', 'Some Unit', '0794440333', 'SIPR', 'ADD TO DOMAIN', '50340', '50505', ''); -- -- Database: `sign_out` -- CREATE DATABASE `sign_out` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; USE `sign_out`; -- -------------------------------------------------------- -- -- Table structure for table `customer sign-out` -- CREATE TABLE IF NOT EXISTS `customer sign-out` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `Sign Out Date` datetime NOT NULL, `Rank/CIV` varchar(255) DEFAULT NULL, `First Name` varchar(255) NOT NULL, `Last Name` varchar(255) NOT NULL, `Unit` varchar(255) NOT NULL, `DSN/Roshan` varchar(255) NOT NULL, `Service Tag/ Serial Number` varchar(255) NOT NULL, `Ticket #` varchar(255) NOT NULL, `Make/ Model` varchar(255) NOT NULL, `Sign Out Verified by:` varchar(255) DEFAULT NULL, PRIMARY KEY (`ID`), KEY `ID` (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ; -- -- Dumping data for table `customer sign-out` -- INSERT INTO `customer sign-out` (`ID`, `Sign Out Date`, `Rank/CIV`, `First Name`, `Last Name`, `Unit`, `DSN/Roshan`, `Service Tag/ Serial Number`, `Ticket #`, `Make/ Model`, `Sign Out Verified by:`) VALUES (9, '0000-00-00 00:00:00', NULL, '', '', '', '', '', '444000', '', NULL); -- -- Database: `switch_in` -- CREATE DATABASE `switch_in` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; USE `switch_in`; -- -------------------------------------------------------- -- -- Table structure for table `networks switch sign-in` -- CREATE TABLE IF NOT EXISTS `networks switch sign-in` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `Date` datetime DEFAULT NULL, `Ticket #` int(11) DEFAULT NULL, `Serial Number` varchar(255) DEFAULT NULL, `Unit Name` varchar(255) DEFAULT NULL, `Net Ops Technician` varchar(255) DEFAULT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ; -- -- Dumping data for table `networks switch sign-in` -- -- -------------------------------------------------------- -- -- Table structure for table `networks switch sign-out` -- CREATE TABLE IF NOT EXISTS `networks switch sign-out` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `Date` datetime DEFAULT NULL, `Ticket #` int(11) DEFAULT NULL, `Serial Number` varchar(255) DEFAULT NULL, `Unit Name` varchar(255) DEFAULT NULL, `Net Ops Technician` varchar(255) DEFAULT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=9 ; -- -- Dumping data for table `networks switch sign-out` -- -- -- Database: `switch_out` -- CREATE DATABASE `switch_out` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; USE `switch_out`;
  13. Okay....let me lay this out very clearly. DB1 = sign_in DB2 = sign_out Both databases are resident inside a XAMPP installation. If I go to phpmyadmin and click on "Databases" it lists them seperately. Inside 'sign_in' there is a table called 'customer sign-in' Inside 'sign_out' there is a table called 'customer sign-out'. I did not create this structure....however it's what I have to work with.
  14. Considering I inherited this database from another user, and am confined to the restraints of what is already established I will go on about this task on my own. I am using two databases because we are tracking the equipment that is brought into the service desk for the duration of the time here in Afghanistan. The fact that anyone would say 'it's wrong' is completely inaccurate. We all do things our own way, and as it is....I will make it work. Thanks for your replies, Carl
  15. Okay so the Subject is odd....but here is the deal. I have the PHP code to display the data from my first database. I have 2 databases, one is for equipment sign_in the other is for equipment sign_out. I want to only display data on the web page if the equipment is listed in sign_in but not in sign_out based on the common field in both called "Ticket #". Here is the code for my initial display page. This displays all data in the database "sign_in" with no caveats or validation from the second DB. ***Yes...I know...root and no password is not safe. This is completely internal, and does not reach out to the net. It's in a sandbox environment using XAMPP right now. Once I go live this will all change**** Any help or direction would be greatly appreciated. It's been a while since I've done PHP...... <?php $db = mysql_connect('localhost', 'root', ''); if (!$db) { echo 'Could not connect to MySQL server. <br />Error # ', mysql_errno(), ' Error msg: ', mysql_error(); exit; } // Select the database you want to use – You can use a variable here too instead if (!mysql_select_db('sign_in', $db)) { // Did selection fail? // Handle error echo 'DB Selection failed. <br />Error # ', mysql_errno(), ' Error msg: ', mysql_error(); exit; } // An example for retrieving zero or more rows $sql = "SELECT * FROM `customer sign-in`"; $result = mysql_query($sql, $db); if (!$result) { // Handle error echo 'Query failed. SQL: ', $sql, '<br />Error # ', mysql_errno(), ' Error msg: ', mysql_error(); exit; } // The while loop stops when there's no data left; it might not even go in loop // and echo anything when there's no data returned on the first call to // mysql_fetch_assoc() echo "<table border='1'> <tr> <th>Sign In Date</th> <th>RANK/CIV</th> <th>First Name</th> <th>Last Name</th> <th>Unit</th> <th>DSN/Roshan</th> <th>Classifications</th> <th>Services Requested</th> <th>Service Tag/ Serial Number</th> <th>Ticket #</th> <th>Make/ Model</th> </tr>"; while($row = mysql_fetch_array($result)) { // Retrieve data until no more { echo "<tr>"; echo "<td>" . $row['Sign in Date'] . "</td>"; echo "<td>" . $row['Rank/CIV'] . "</td>"; echo "<td>" . $row['First Name'] . "</td>"; echo "<td>" . $row['Last Name'] . "</td>"; echo "<td>" . $row['Unit'] . "</td>"; echo "<td>" . $row['DSN/Roshan'] . "</td>"; echo "<td>" . $row['Classifications'] . "</td>"; echo "<td>" . $row['Services Requested'] . "</td>"; echo "<td>" . $row['Service Tag/ Serial Number'] . "</td>"; echo "<td>" . $row['Ticket #'] . "</td>"; echo "<td>" . $row['Make/ Model'] . "</td>"; echo "</tr>"; } } ?>
×
×
  • 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.