Jump to content

cerebrus189

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Female

cerebrus189's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I figured it out with that little snippet of code added in. Here's the final code. if ($numrows > 0) { echo "<p align=\"left\" class=\"style2 style4\">Click in the check box next to the date for which you would like to register: </p>"; echo "<p align=\"left\" class=\"style2 style4\">" . $_GET['classname'] . "</p>"; echo "<table width=100% style=\"color:#FFFFFF\">"; echo "<th></th>"; echo "<th>Date</th>"; echo "<th>Time</th>"; echo "<th>Location</th>"; echo "<th>Instructor</th>"; while ($results = mysql_fetch_array($rs)){ echo "<tr>"; echo "<td><input type=\"radio\" name=\"checkbox\" value=\"" . $results['date'] . "|" . $results['time'] . "|" . $results['location'] . "|" . $results['instructor'] . "|" . $results['course'] . "\"" . "></td>"; echo "<td class=\"style11\">" . $results['date'] . "</td>"; echo "<td class=\"style11\">" . $results['time'] . "</td>"; echo "<td class=\"style11\">" . $results['location'] . "</td>"; echo "<td class=\"style11\">" . $results['instructor'] . "</td>"; echo "</tr>"; } echo "</table>"; } else {if (strpos($_REQUEST['classname'], "BloodBorne Pathogens Video") !== false){ echo "Bloodborne Pathogens is exclusively offered online. Please <a href=../training/online_courses/Bloodborne/BB.html>click here</a> to take the course."; } else { echo "Please call the training department.";} }
  2. Hi all, I'm wondering if it's possible to use the $numrows boolean parameter where $numrows = 0 and meets a condition. For instance, my code is set up to check for classes where $numrows>0 and then displays the classes. If $numrows < 1, it echoes a message saying there are no classes available and to call the training department. I would like to redirect one of the classes to another link by using a strpos function to search for the classname within the URL. As I understand it, I would have to embed it in the else part of the statement if it's at all possible. Here's what I have so far. if ($numrows > 0) { echo "<p align=\"left\" class=\"style2 style4\">Click in the check box next to the date for which you would like to register: </p>"; echo "<p align=\"left\" class=\"style2 style4\">" . $_GET['classname'] . "</p>"; echo "<table width=100% style=\"color:#FFFFFF\">"; echo "<th></th>"; echo "<th>Date</th>"; echo "<th>Time</th>"; echo "<th>Location</th>"; echo "<th>Instructor</th>"; while ($results = mysql_fetch_array($rs)){ echo "<tr>"; echo "<td><input type=\"radio\" name=\"checkbox\" value=\"" . $results['date'] . "|" . $results['time'] . "|" . $results['location'] . "|" . $results['instructor'] . "|" . $results['course'] . "\"" . "></td>"; echo "<td class=\"style11\">" . $results['date'] . "</td>"; echo "<td class=\"style11\">" . $results['time'] . "</td>"; echo "<td class=\"style11\">" . $results['location'] . "</td>"; echo "<td class=\"style11\">" . $results['instructor'] . "</td>"; echo "</tr>"; } echo "</table>"; } elseif (strpos($_REQUEST['classname'], "BloodBorne Pathogens Video")); { echo "Bloodborne Pathogens is exclusively offered online. Please <a href=../training/online_courses/Bloodborne/BB.html>click here</a> to take the course."; } else { echo "Please call the training department as there are no classes scheduled at this time." } Please let me know if this is even possible or if I'm off my rocker. I'm fairly new to the PHP world but not a newb Thanks a bunch for your time!
  3. Yay! That worked beautifully! Thank you for your help! Yvette
  4. So I have this page that outputs a sql query for required courses (healthcare field) and creates an email based on user input (variable). The email sends and I receive the information but the format is jacked up. My markup in the email shows. As an example, I should be getting this. Course Date Mandt Recert 1/16/2011 AWMD Recert 9/15/2010 etc, etc. What I currently get in the email is this: <table width=100% class="style11"><th align="left"><u>Course</u></th><th align="left"><u>Complete By</u></th><th align="left"> <th><tr><td width=33%>Abuse Neglect and Exploitation</td><td width=10%>12-31-1997</td><td width=33%></td></tr><tr><td width=33%>BloodBorne Pathogens Video</td><td width=10%>04-18-2008</td><td width=33%></td></tr><tr><td width=33%>MANDT Recert</td><td width=10%>08-11-2010</td><td width=33%></td></tr><tr><td width=33%>AWMD Recert</td><td width=10%>06-28-2011</td><td width=33%></td></tr><tr><td width=33%>CPR/1st Aid Combo</td><td width=10%>07-16-2012</td><td width=33%></td></tr></table></body></html> <?php //connect to the database include 'dbcommon.php'; $conn = mysql_connect($dbhost, $username, $password) or die("Could not show the required classes." . mysql_error($conn)); mysql_select_db($dbname); //grab the classes that are required $query="SELECT course, date_last_taken, certification FROM course_completions WHERE employee_id='" . $_REQUEST['employid'] . "' order by date_last_taken asc"; $rs = mysql_query($query, $conn); $numrequired = mysql_num_rows($rs); $emailtext .= "<table width=100% class=\"style11\">"; $emailtext .= "<th align=\"left\"><u>Course</u></th><th align=\"left\"><u>Complete By</u></th><th align=\"left\"> <th>"; if ($numrequired == 0) { $emailtext .= "<html>\n"; $emailtext .= "<body>"; $emailtext .= "<tr><td colspan=3>No classes required</td></tr>"; } while ($results = mysql_fetch_array($rs)) { $emailtext .= "<tr>"; $emailtext .= "<td width=33%>"; $emailtext .= $results["course"]; $emailtext .= "</td>"; $emailtext .= "<td width=10%>"; $emailtext .= date("m-d-Y",strtotime($results["date_last_taken"])); $emailtext .= "</td>"; $emailtext .= "<td width=33%>"; $emailtext .= "</td>"; $emailtext .= "</tr>"; } $emailtext .= "</table>"; $emailtext .= "</body>"; $emailtext .= "</html>"; echo $emailtext; mysql_close($conn); $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n"; //email the results/ $email = $_REQUEST["email"]; $comment = "message1"; $subject = " ARCA Required Courses "; $message = $emailtext; mail($email, $subject, $message); if ($mail) { echo "Email sent, click <a href=displaycourses.php?" . SID . ">here</a> to return."; } else { echo "There was a problem sending the email."; } ?> I'm sure the syntax isn't correct somewhere but I need help with the output of the email formatting. Thanks!
  5. Hi all, I've got a training database here that displays both supervisor and their employee's information regarding training classes. As an assignment, I must create a way for the supervisors view/print each employee's record as far as what is left to do for training. What's the best way to accomplish this? Any ideas? I would like to have a print/view button with some plain text but it needs to be available for each employee from the supervisor's page so that each employee has a separate view window that pops open. I thought PHP might work for me since almost our whole website is done in PHP and this is how I'd pass the parameters. But I'm also thinking that javascript would be helpful for the actual print function. As far as the code goes, this is a small snippet of the supervisor's employees code. //get list of all of the supervisor's employees $query = "SELECT * FROM employees WHERE supervisor_id=" . $_SESSION['empNo']; $rs = mysql_query($query, $conn); $numEmployees = mysql_num_rows($rs); while ($numEmployees != 0) { echo "<p align=\"left\" class=\"style11\"><span class=\"style2 style4\">Your Employee's Classes</span></p>"; echo "<p align=\"left\" class=\"style11\">"; for ($b = 0; $b < $numEmployees; $b++){ $result = mysql_fetch_array($rs); //grab the classes that are required $innerquery="SELECT course, date_last_taken, certification FROM course_completions WHERE employee_id='" . $result['employee_id'] . "' order by date_last_taken asc"; $innerrs = mysql_query($innerquery, $conn); $numcourses = mysql_num_rows($innerrs); echo "<span class=\"style2 style4\">" .$result['last_name'] . ", " . $result['first_name'] . "</span><br />"; echo "<span style=\"color:#FFFF00\">Required Classes</span><br />"; echo "<table width=100% class=\"style11\">"; echo "<th align=\"left\">Course</th><th align=\"left\">Complete By</th><th align=\"left\">Action</th>"; while ($innerresults = mysql_fetch_array($innerrs)) { echo "<tr>"; echo "<td width=33%>"; echo $innerresults["course"]; echo "</td><td width=10%>"; echo date("m-d-Y",strtotime($innerresults["date_last_taken"])); echo "</td><td width=57%>"; echo "<a href=\"employeeregister.php?" . SID . "&classname=" . $innerresults["course"] . "&employid=" . $result['employee_id'] . "\">Register</a>"; echo "</td></tr>"; } echo "</table><br />"; //grab the classes that are enrolled $innerquery = "SELECT course, course_enrollment_id, employee_id, status, date FROM course_enrollment WHERE employee_id='" . $result['employee_id'] . "' order by date asc"; $innerrs = mysql_query($innerquery, $conn); $numcourses = mysql_num_rows($innerrs); echo "<span style=\"color:#FFFF00\"> Registered Classes</span>"; echo "<table width=100% class=\"style11\">"; echo "<th align=\"left\"><b>Class Name</b></th><th align=\"left\">Class Date</th><th align=\"left\">Status</th><th align=\"left\">Select Cancel to Dis-Enroll from a Class</th>"; if ($numcourses ==0) { echo "<tr><td width=33%>No classes enrolled</td><td width=10%> </td><td width=10%> </td></tr>"; } while ($innerresults = mysql_fetch_array($innerrs)) { echo "<tr>"; echo "<td width=33%>"; echo $innerresults["course"]; echo "</td><td width=10%>"; if ($innerresults["date"] == "0000-00-00") { echo "CANCELED"; echo "</td><td width=10%> </td> <td width=47%> </td></tr>"; } else { echo date("m-d-Y",strtotime($innerresults["date"])); echo "<td width=10%>". $innerresults['status'] . "</td>"; echo "</td><td width=47%><a href=\"cancelclass.php?" . SID . "&classid=" . $innerresults["course_enrollment_id"] . "&classname=" . $innerresults["course"] ."&classdate=" . $innerresults["date"] . "\">Cancel</a></td></tr>"; } } echo "</table><br />"; } } I'm thinking the code would go somewhere in here as far as the button is concerned so that maybe it can simply be echoed based on being in a div tag or other html structure.
  6. Okay, I'll try listening better. Sorry about that. I really do appreciate the help. When I tried rendering the page on the server through //localhost/ it displayed the x's so when I inquired about the properties of the images, it was looking for them in the root folder. So I basically took all the files from inside that Opening Doors Folder and went up a few levels to the wwwroot folder where I put everything and voila!! They're all there now but my menus are acting screwy. So it was an issue with the structure and the availability of the images contained in the root folder of the webdev server. Now that I know how to correct it (well mostly until I play around with it a bit more), I can fix the issue.
  7. It's not a problem with my code. I believe it has more to do with my file structure. I'm able to render the pages perfectly on the remote server (Linux box) but not locally on Windows box using PHP. I included a screenshot of what I'm seeing as well as the index.php file code. All of the websites were recently moved under IIS folder Inetpub/wwwroot/ directory. They are also all listed under the main "Default Web Site" directly in IIS. Could this be the issue? I also checked my scripts to be sure they are enabled in the properties option. It should be noted that our intranet, which is on the same level in IIS and in the file directly runs PHP just fine. [attachment deleted by admin]
  8. Solved this issue myself. Here's the final code in case anybody else has the problem. It was an issue with the loop. <style> table { text-align: left; border-collapse: collapse; } tr:hover { background: blue; color: white } th, td { padding: 7px } </style> <?php function pullLDAP($name){ /* * This function pulls the OU data from LDAP based on the user name * It will return only the first OU that the user is in */ //LDAP Connection information $host='...'; $password='...'; $bindDN='...\serverconsole'; //Get LDAP configuration settings. $ds = ldap_connect($host) or die ('Could not connect!'); ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); $r = ldap_bind($ds, $bindDN, $password); //sAMAccountName is the name of the field in LDAP for the username $attributes = array('sAMAccountName'); //we will query LDAP, using the binding from outside the function $result = ldap_search($ds, "ou=Arca,dc=int,dc=arc-a,dc=org", "(sAMAccountName=$name)", $attributes); $entries = ldap_get_entries($ds, $result); //we now have the dn and need to filter it $dn = $entries[0]['dn']; //we only want to grab the first OU, so we filter that $splitvalue = split(",",$dn); //Remove the =CN= from the beginning, so it is just the OU return substr($splitvalue[1],3); } //get last month for the filenames $lastMonth = sprintf("%02d", date("m") - 1); $thisYear = date("Y"); $fileLastMonth = $thisYear . $lastMonth; //$fileLastMonth = "201001"; //pull last month and year //$tablename = "Ricoh_" + date("FY",mktime(0, 0, 0, date("m")-1, date("d"), date("Y"))); $tablename = "Testing2010"; echo "<table>\n"; $row = 0; $handle = fopen("Ricoh/RICOH_MP9000_print.csv", "r"); //Create SQL Credentials $SQLUser = ".."; $SQLPass = "..."; $DSNName = "PrintReports"; //connect to the Database $SQLConn = odbc_connect($DSNName, $SQLUser, $SQLPass) or die ("The Database is unavailable"); //if the table already exists, delete it $query = "IF OBJECT_ID ('$tablename') IS NOT NULL DROP TABLE $tablename"; odbc_exec($SQLConn, $query); $query = "CREATE TABLE $tablename (recordId int IDENTITY(1,1),DepartmentCode varchar(50), DepartmentName varchar(50), BWCopy int, BWPrint int, PRIMARY KEY (recordId))"; odbc_exec($SQLConn, $query); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { if ($row == 0) { // this is the first line of the csv file // it usually contains titles of columns $num = count($data); echo "<thead>\n<tr>"; $row++; for ($c=0; $c < $num; $c++) { echo "<th>" . $data[$c] . "</th>"; } echo "</tr>\n</thead>\n\n<tbody>"; } else { // this handles the rest of the lines of the csv file $num = count($data); echo "<tr>"; $row++; for ($c=0; $c < $num; $c++) { echo "<td>" . $data[$c] . "</td>"; } $query = "INSERT INTO ".$tablename." (DepartmentCode, DepartmentName, BWCopy, BWPrint) VALUES ('" . $data[1] . "','" . $data[2] . "', '" . $data[3] . "','" . $data[4] . "') where DepartmentCode != null"; odbc_exec($SQLConn, $query); echo "</tr>\n"; } } echo "</tbody>\n</table>"; //Write to DB odbc_close($SQLConn); ?>
  9. There's an echo in here...and I'm not talking PHP. Anybody have any input?
  10. As far as I can tell, my insert statement should be within the loop statement but I'm not quite sure how this fits into my table rendering. Input please on if this is right... // this handles the rest of the lines of the csv file $num = count($data); echo "<tr>"; $row++; for ($c=0; $c < $num; $c++) { echo "<td>" . $data[$c] . "</td>"; $query = "INSERT INTO $tablename (DepartmentCode, DepartmentName, BWCopy, BWPrint) VALUES ('" . $data[1] . "','" . $data[2] . "', '" . $data[3] . "','" . $data[4] . "')"; } echo "</tr>\n"; } } echo "</tbody>\n</table>"; Earlier in my code, I'm able to create the table in SQL Server but all info is null when I run the parse.php file. I've attached the code in its entirety as a file. If somebody is willing to look at it, I'd be very grateful. [attachment deleted by admin]
  11. Understood. Here's the PHP code responsible for showing the include file. This bit of code is listed in all my relevant files that I've just created. The '/' is necessary for navigation since these files are contained within a folder named News. <?php include($_SERVER['DOCUMENT_ROOT']. 'topstuff.php'); ?> This is the navigation it should be showing. Attached is a screenshot of my files. The PHP installation folder is just below the file navigation, on the same level as the Inetpub folder. [attachment deleted by admin]
  12. Are you talking about my site's files such as picture location, etc? If you are, that's not the issue. I've checked everything as far as location goes and my file structure is fine. Its not rendering my php include properly.
  13. I have accessed the elements, in this case topstuff.php which is included in the root folder of my website. The index_files references for pictures has also been checked. Now when I render the page, it doesn't render any x's. But at work, I was able to get it to render x's in firefox. That's why I believed it was a problem with php. When I look at the the php files, I see no reference to any domain. Where would I check this otherwise? This is the type of information that is needed because I don't know enough about php to check something like this.
  14. i moved the entire site over to the test server. so yeah all the files are there and moved into the same exact file structure as the one on our remote server.
  15. Hi all, Got a relatively simple question here hopefully. I've updated my files to include some new PHP files (html should have been used cuz there's nothing dynamic about the site when it comes to these pages but I'm retaining consistency site-wide) and I'm now testing these on the test server which hosts our intranet and the other server is our web development server, both of which have PHP installed and both of which are rendering the same way. However, when I access the page, the PHP include topstuff.php isn't rendering at all. I'm getting some little x's where the navigation should be but nothing else. The X's give me a title, so the idea of the navigation is being rendered but its not loading completely. The bottom PHP include file is rendered properly but includes only text. Could this be a problem with navigation to the pictures in the PHP file? Or is this something different as far as the PHP client-side files are concerned?
×
×
  • 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.