Jump to content

Moron

Members
  • Posts

    369
  • Joined

  • Last visited

Everything posted by Moron

  1. The check number and date cannot be the same, so the check number can be the distinguishing field. How do I express that here? while ($RESULT = mssql_fetch_assoc($RESULTDS)) { $endingdate = $RESULT['PSTUB5']; $month = substr("$endingdate", -8, 2); $day = substr("$endingdate", -6, 2); $year = substr("$endingdate", -4, 4); $Date = $month."/".$day."/".$year; echo "<a href=\"paystubpopup.php?Date=".$endingdate."\" target=\"_blank\">"; echo $Date; echo "</a>"; i.e. How do I add the check number field to the URL variable?
  2. There is still a problem.... removing DISTINCT from the query makes it list all records, but both links for the 29th bring up the same record. How can I make this: while ($RESULT = mssql_fetch_assoc($RESULTDS)) { $endingdate = $RESULT['PSTUB5']; $month = substr("$endingdate", -8, 2); $day = substr("$endingdate", -6, 2); $year = substr("$endingdate", -4, 4); $Date = $month."/".$day."/".$year; echo "<a href=\"paystubpopup.php?Date=".$endingdate."\" target=\"_blank\">"; echo $Date; echo "</a>"; echo "<BR>"; .... distinguish between the two?
  3. Thank you! That did the trick! I was using code from a previous query and I had used DISTINCT for whatever reason at the time.
  4. Yes, $RESULTDS is correct. The "DS" part is an acronym for my department. Everything works except when there is more than one record for a given date. That's why I suspect that the first code I posted might be the problem instead of the query.
  5. Here's the actual query: $RESULTDS=mssql_query("SELECT DISTINCT LH.[EMPNO], M2.[hrYRAT], M2.[EMPNO], M2.[MANLAP], M2.[PAYCTR], M2.[MANLAC], M2.[MANLTC], M2.[MSKLAB], M2.[MSKLTC], M2.[NAMEMI], M2.[NAMEL], M2.[NAMEF], EH.[DATE], EH.[ENETPA], EH.[EGRSER], EH.[EREGHR], EH.[EDEDUC], EH.[EROTHR], EH.[EFWHD], EH.[EPEDAT], EH.[ESSDED], EH.[EHOSPD], EH.[ELIFED], EH.[ECRUD], M2.[POSITN], M2.[MCTDWH], M2.[MHDATE], M2.[MCTDCS], M2.[MO3TOT], M2.[MCTDLD], M2.[MCTDGE], M2.[MALPPP], M2.[MSLPPP], M2.[MWHSTA], M2.[MWHALL], M2.[MWHADD], EH.[EGARND], EP.[EMPNO], DP.[EMPNO], EI.[DDEPTN], EI.[NEWOCC], EI.[hrYRAT], EI.[MEMPAD], EI.[MEMPCS], EI.[MEMPZI], PA.[PSTUB1], PA.[PSTUB5], PA.[PSTUB6], PA.[PSTUB2], PA.[PSTUB3], PA.[PSTUB4], PA.[PSTUB7], PA.[PSTUB8], PA.[PSTUB9], PA.[PSTU10], PA.[PSTU11], PA.[PSTU12], PA.[PSTU13], PA.[PSTU14], PA.[PSTU15], PA.[PSTU16], PA.[PSTU17], PA.[PSTU18], PA.[PSTU19], PA.[PSTU28], PA.[PSTU29], PA.[PSTU30], PA.[PSTU20], PA.[PSTU21], PA.[PSTU30], PA.[PSTU26], PA.[PSTU31], PA.[PSTU36], PA.[PSTU37], PA.[PSTU42], PA.[PSTU43], PA.[PSTU44], PA.[PSTU45], PA.[PSTU46], PA.[PSTU47], PA.[PSTU48], PA.[PSTU22], PA.[PSTU23], PA.[PSTU24], PA.[PSTU25], PA.[PSTU27], PA.[PSTU32], PA.[PSTU33], PA.[PSTU34], PA.[PSTU35], PA.[PSTU49], PA.[PSTU50], PA.[PSTU51], PA.[PSTU52], PA.[PSTU53], PA.[PSTU38], PA.[PSTU39], PA.[PSTU54], PA.[PSTU55], PA.[PSTU57] FROM MASTERL2 M2 LEFT JOIN LeaveHistory LH ON LH.[EMPNO]=M2.EMPNO LEFT JOIN EARNHIST EH ON EH.[EEMPNO]=M2.EMPNO LEFT JOIN EMPPICTURE EP ON EP.[EMPNO]=EH.EEMPNO LEFT JOIN Departments DP ON DP.[EMPNO]=EP.EMPNO LEFT JOIN View_EmployeeInfo EI ON EI.[EMPNO]=M2.EMPNO LEFT JOIN PAYSTUBS_Archive PA ON PA.[PSTUB2]=M2.EMPNO WHERE PA.[PSTUB2] = '".$_SESSION['empcode']."' ORDER BY PA.[PSTU57] desc"); $RESULT=mssql_fetch_assoc($RESULTDS); Is there some reason it wouldn't be pulling all of the records? On mine, I have two records for Nov 29 and one for November 15. It pulls the November 15 record and ONE for the 29th.
  6. while ($RESULT = mssql_fetch_assoc($RESULTDS)) { $endingdate = $RESULT['PSTUB5']; $month = substr("$endingdate", -8, 2); $day = substr("$endingdate", -6, 2); $year = substr("$endingdate", -4, 4); $Date = $month."/".$day."/".$year; echo "<a href=\"paystubpopup.php?Date=".$endingdate."\" target=\"_blank\">"; echo $Date; echo "</a>"; echo "<BR>"; It works perfectly, EXCEPT..... if there is more than one database entry for a certain date, it only displays one of them. Ideas?
  7. Your second example seems to be working for me. Adapting it to my code I'm using: <?php $message62 = isset($RESULT['PSTU62'])?trim($RESULT['PSTU62']):null; if(!is_null($message62) && $message62 != "") { echo $RESULT['PSTU62']."<br />"; } $message63 = isset($RESULT['PSTU63'])?trim($RESULT['PSTU63']):null; if(!is_null(message63) && message63 != "") { echo $RESULT['PSTU63']."<br />"; } $message64 = isset($RESULT['PSTU64'])?trim($RESULT['PSTU64']):null; if(!is_null(message64) && $message64 != "") { echo $RESULT['PSTU64']."<br />"; } ?> ...etc..... Thanks!
  8. Thanks, but I'm getting the same result, a "<BR>" inserted even when the field is empty. Using your example, my code now reads: <?php if(!empty($RESULT['PSTU62'])) { echo $RESULT['PSTU62']."<br />"; } ?>
  9. <?php if(!empty($RESULT['PSTU62'])) { echo $RESULT['PSTU62']; echo "<BR>"; } else { } ?> If there is data in the field it echoes it and inserts a break (HTML <BR> tag). But..... if there's nothing in a field, it still inserts a break tag anyway, resulting in too many spaces between entries. Ideas? ???
  10. It works! Thanks again. Currently, there is only one Pay Period Ending date in the table, but I see no reason it won't work fine once there are more.
  11. Thanks, Brian. I'll try it in a bit. This is on our internal Intranet, so if we have a hacker I think we'll catch him pretty quickly!
  12. Thanks for your help, Brian. Yes, this has been confusing. Let me try to express myself a bit better. I understand that the above code isn't a proper HTML "form." What I want is the following: 1. Get the available pay period ending dates through a query (already working). 2. List them and make them links (working). NOTE: The reason I'm breaking up the date is for display purposes only ("12/15/2008" looks a bit more human-readable than "12152008"). But it's the actual date value ($RESULT['PSTUB5']) that I'm trying to pass to the next page. 3. Pass the selected variable ($RESULT['PSTUB5']) into the query on the next page by using sessions or whatever technique I can (WHERE $RESULT['PSTUB5'] = $_SESSION['enddate']) . That's what I'm really getting at; when a user clicks a Pay Period Ending Date, I want to pass that selected Pay Period Ending Date into the query on the next page, thereby pulling the record for that date. As for forms, I don't really want an HTML "select" with a dropdown; I want a list to appear instead, which is what I have now. Sorry for the confusion. Does this make a bit more sense? Thanks again.
  13. Here it is: <?php $RESULTDS=mssql_query("SELECT DISTINCT M2.[EMPNO], PS.[PSTUB5] FROM MASTERL2 M2 LEFT JOIN PAYSTUBS PS ON PS.[PSTUB2]=M2.EMPNO WHERE M2.[EMPNO] = '".$_SESSION['empcode']."' ORDER BY PS.[PSTUB5]"); $RESULT=mssql_fetch_assoc($RESULTDS); mssql_data_seek($RESULTDS,0); echo "<CENTER>"; echo "<font size=2 color=#000000 face=arial>"; echo "Please select a stub to view:"; echo "</font>"; echo "</CENTER>"; echo "<BR>"; echo "<form action=\"paystubs.php\" name=\"paystubs\" value=\"ppeenddate\" method=\"post\">"; while ($RESULT = mssql_fetch_assoc($RESULTDS)) { $endingdate = $RESULT['PSTUB5']; $month = substr("$endingdate", -8, 2); $day = substr("$endingdate", -6, 2); $year = substr("$endingdate", -4, 4); echo "<CENTER>"; echo "<font size=2 color=#0000ff face=arial>"; echo "<a href=\"paystubs.php\">"; echo $month; echo "/"; echo $day; echo "/"; echo $year; echo "</a>"; echo "</form>"; echo "</font>"; echo "</CENTER>"; echo "<BR>"; } ?> The above does what I want; it lists the available Pay Period Ending dates ($RESULT['PSTUB5']) from the database table and also makes them clickable. I just can't seem to pass $RESULT['PSTUB5'] as a variable to the next page. This variable will tell it what date to pull the record for.
  14. For some reason, that isn't making it a $_POST value. I can echo other post or session values on the page, but this gives me nothing. Isn't there a way to make ANY value a $_SESSION variable?
  15. So using this code: while ($RESULT = mssql_fetch_assoc($RESULTDS)) { $endingdate = $RESULT['PSTUB5']; $month = substr("$endingdate", -8, 2); $day = substr("$endingdate", -6, 2); $year = substr("$endingdate", -4, 4); echo "<CENTER>"; echo "<font size=2 color=#0000ff face=arial>"; echo $month; echo "/"; echo $day; echo "/"; echo $year; echo "</font>"; echo "</CENTER>"; ...how do I make "$RESULT['PSTUB5']" a "post" value and also make it linkable?
  16. Can I not just make the selected item a "post" value in php and pass it that way?
  17. Okay, I now have it pulling the records of available paystubs for each employee and populating a list. So if you all don't mind, help me with my thinking here.... Next I need to make each item in the list linkable (duh). Then I need to pass the date they're clicking as a variable into the query on the results page right? Or am I missing something?
  18. Sounds good to me. I just plugged in a dynamic javascript dropdown to list the entries when they click the button. I can write the query in question. Any good starting point on plugging into the select fields?
  19. Okay, I'm working on a project for employee paystubs. It's working great, but...... when they click the "Paystubs" button, I want it to drop down a list of entries for their name in the database so they can pick and click one. The table I'm using is brand new and only contains the latest and greatest data (thus, one record per person), but soon there will be an archive. I want to display a list and let them pick. Any guidance is appreciated as always.
  20. printf() did the trick. Thanks, everyone!
  21. This is probably dirt simple, but I'm having a problem finding it in the manual. In the database, if a number is five digits, my code echoes the entire five digits (12345), of course. If it's a single digit, I want to append four zeros to the beginning of it (00004, etc...). How is this done? Thanks!
  22. I'll keep this long and painful story as short as possible. We have an Access 2000 database that is used for making identification cards. It pulls the data from an MS SQL database through an ODBC connection. Well, it suddenly got VERY slow to pull any records. I can run an older backup copy of the Access database and anything that was already in there runs fine. BUT... if I refresh the connection to the SQL tables (in Linked Table Manager), it suddenly takes 10-15 minutes to pull a single record and then I can't edit it once it does. All of the SQL tables run fine within Enterprise Manager. The Access database itself runs fine until I try to refresh the connections in Linked Table Manager. Any ideas? I'm stumped and so are a few other people.
  23. I tried some other databases and it worked. Who knows? Maybe my migration from CSV didn't work properly. Thanks.
  24. When I click Browse here, all I get is a history of database activity (tables created, etc....). I want to browse the actual records.
  25. I don't have any such button or link. I'm using the version of PHPMyAdmin that loaded with Wampserver 5.
×
×
  • 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.