Moron Posted April 8, 2008 Share Posted April 8, 2008 Sorry for the panic, but.... Here's the query: $RESULTDS=mssql_query("SELECT DISTINCT LH.[Employee Number], 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.[MSSNO], 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], DP.[Department] FROM MASTERL2 M2 LEFT JOIN LEAVHST LH ON LH.[Employee Number]=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 WHERE M2.[EMPNO] = '".$_POST['empcode']."' AND $lastfour = '".$_POST['password']."' ORDER BY M2.[EMPNO] desc"); I need their entered password to match the last four of the SSN (M2.[MSSNO]). I can put this AFTER the query: $lastfour = substr($RESULT['MSSNO'], -4); But how can I define it BEFORE the query or INSIDE the WHERE statement? Thanks. EDIT: I just went "live" with this today and discovered that an employee can put another employee's employee number with ANY password and it works. NOT GOOD. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted April 8, 2008 Share Posted April 8, 2008 Well i wasn't going to answer, given the annoying title. But see substr() here: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html Quote Link to comment Share on other sites More sharing options...
Moron Posted April 8, 2008 Author Share Posted April 8, 2008 Well i wasn't going to answer, given the annoying title. But see substr() here: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html Okay, I edited the title. BUT....how do I incorporate this into the above query -OR- how do I define "$lastfour" BEFORE the query, since it uses data returned BY the query? Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted April 8, 2008 Share Posted April 8, 2008 My mistake - i read the question and not the code. Didn't notice you were using mssql. I would expect the required WHERE clause to be something along the lines of: WHERE M2.[EMPNO] = '".$_POST['empcode']."' AND substr(M2.[MSSNO,-4) = '".$_POST['password']."' However, I've never worked with mssql and cant seem to find any documentation on the web for string functions in mssql, so it is almost certainly different from the above. Quote Link to comment Share on other sites More sharing options...
Moron Posted April 8, 2008 Author Share Posted April 8, 2008 My mistake - i read the question and not the code. Didn't notice you were using mssql. I would expect the required WHERE clause to be something along the lines of: WHERE M2.[EMPNO] = '".$_POST['empcode']."' AND substr(M2.[MSSNO,-4) = '".$_POST['password']."' However, I've never worked with mssql and cant seem to find any documentation on the web for string functions in mssql, so it is almost certainly different from the above. Thanks, but it's throwing errors. Quote Link to comment Share on other sites More sharing options...
craygo Posted April 8, 2008 Share Posted April 8, 2008 substr should be substring WHERE M2.[EMPNO] = '".$_POST['empcode']."' AND SUBSTRING(M2.[MSSNO,-4) = '".$_POST['password']."' Can try that Ray Quote Link to comment Share on other sites More sharing options...
Moron Posted April 8, 2008 Author Share Posted April 8, 2008 substr should be substring WHERE M2.[EMPNO] = '".$_POST['empcode']."' AND SUBSTRING(M2.[MSSNO,-4) = '".$_POST['password']."' Can try that Ray Thanks, but it errors. It says that the "substring function requires 3 arguments." Quote Link to comment Share on other sites More sharing options...
craygo Posted April 8, 2008 Share Posted April 8, 2008 I know this is redundant but I don't use mssql very much but try WHERE M2.[EMPNO] = '".$_POST['empcode']."' AND SUBSTRING(M2.[MSSNO],-4,4) = '".$_POST['password']."' also from my access days try using right WHERE M2.[EMPNO] = '".$_POST['empcode']."' AND RIGHT(M2.[MSSNO],4) = '".$_POST['password']."' Ray Quote Link to comment Share on other sites More sharing options...
Moron Posted April 8, 2008 Author Share Posted April 8, 2008 I know this is redundant but I don't use mssql very much but try WHERE M2.[EMPNO] = '".$_POST['empcode']."' AND SUBSTRING(M2.[MSSNO],-4,4) = '".$_POST['password']."' Ray Thanks, Ray, but this one crashes because, apparently, it's not pulling from M2.[MSSNO]. It goes to my "die" statement. Quote Link to comment Share on other sites More sharing options...
cgm225 Posted April 8, 2008 Share Posted April 8, 2008 Can't hurt for you to read this too: http://catb.org/~esr/faqs/smart-questions.html Quote Link to comment Share on other sites More sharing options...
craygo Posted April 8, 2008 Share Posted April 8, 2008 OK cgm that helps. Back on topic. Mssql may not support -4 like mysql does. Since all SS numbers are the same length you can still do this. if you are storing the number with the hyphens then WHERE M2.[EMPNO] = '".$_POST['empcode']."' AND SUBSTRING(M2.[MSSNO],8,4) = '".$_POST['password']."' May be 7 not 8. Not sure if mssql starts at 0 or 1 without the hyphens WHERE M2.[EMPNO] = '".$_POST['empcode']."' AND SUBSTRING(M2.[MSSNO],6,4) = '".$_POST['password']."' Again may be 5 not 6. Ray Quote Link to comment Share on other sites More sharing options...
Moron Posted April 8, 2008 Author Share Posted April 8, 2008 OK cgm that helps. Back on topic. Mssql may not support -4 like mysql does. Since all SS numbers are the same length you can still do this. if you are storing the number with the hyphens then WHERE M2.[EMPNO] = '".$_POST['empcode']."' AND SUBSTRING(M2.[MSSNO],8,4) = '".$_POST['password']."' May be 7 not 8. Not sure if mssql starts at 0 or 1 without the hyphens WHERE M2.[EMPNO] = '".$_POST['empcode']."' AND SUBSTRING(M2.[MSSNO],6,4) = '".$_POST['password']."' Again may be 5 not 6. Ray Thanks again, Ray, but it still goes to the "die" statement. Quote Link to comment Share on other sites More sharing options...
Moron Posted April 8, 2008 Author Share Posted April 8, 2008 Maybe the entire query will help: $RESULTDS=mssql_query("SELECT DISTINCT LH.[Employee Number], 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], DP.[Department] FROM MASTERL2 M2 LEFT JOIN LEAVHST LH ON LH.[Employee Number]=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 WHERE ((M2.[EMPNO] = '".$_POST['empcode']."' and $lastfour = '".$_POST['password']."') or ($lastfour = '".$_SESSION['password']."' and M2.[EMPNO] = '".$_SESSION['empcode']."')) ORDER BY M2.[EMPNO] desc"); What I really WANT to have work is: WHERE ((M2.[EMPNO] = '".$_POST['empcode']."' and '".$_POST['password']."' = substr(M2.[MSSNO], -4)) Is is just that my syntax is wrong (missing quotes or whatnot) or is this query not logical? Quote Link to comment Share on other sites More sharing options...
craygo Posted April 8, 2008 Share Posted April 8, 2008 make your query a variable so you can echo it out <?php $sql = "SELECT DISTINCT LH.[Employee Number], 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], DP.[Department] FROM MASTERL2 M2 LEFT JOIN LEAVHST LH ON LH.[Employee Number]=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 WHERE ((M2.[EMPNO] = '".$_POST['empcode']."' and $lastfour = '".$_POST['password']."') or ($lastfour = '".$_SESSION['password']."' and M2.[EMPNO] = '".$_SESSION['empcode']."')) ORDER BY M2.[EMPNO] desc"; echo $sql; //$RESULTDS = mssql_query($sql) or die(mssql_error()); ?> You can always get the results and compare it after $rows = mssql_fetch_assoc($RESULTDS); $lastfour = substr($rows['MSSNO'], -4); if($lastfour == $_POST['password']){ // run rest of script } else { echo "passwords don't match"; } Ray Quote Link to comment Share on other sites More sharing options...
Moron Posted April 8, 2008 Author Share Posted April 8, 2008 make your query a variable so you can echo it out <?php $sql = "SELECT DISTINCT LH.[Employee Number], 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], DP.[Department] FROM MASTERL2 M2 LEFT JOIN LEAVHST LH ON LH.[Employee Number]=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 WHERE ((M2.[EMPNO] = '".$_POST['empcode']."' and $lastfour = '".$_POST['password']."') or ($lastfour = '".$_SESSION['password']."' and M2.[EMPNO] = '".$_SESSION['empcode']."')) ORDER BY M2.[EMPNO] desc"; echo $sql; //$RESULTDS = mssql_query($sql) or die(mssql_error()); ?> You can always get the results and compare it after $rows = mssql_fetch_assoc($RESULTDS); $lastfour = substr($rows['MSSNO'], -4); if($lastfour == $_POST['password']){ // run rest of script } else { echo "passwords don't match"; } Ray Okay, maybe we're getting somewhere now. It gives me "passwords don't match" as stated in your code. One thing, though; forget about "lastfour." This is lastfour: $lastfour = substr($_SESSION['password'], -4); // returns last four of password I must have been asleep when I wrote that one. I need the password, as entered by the employee, to match the last four digits of M2[MSSNO]. What should I try next? EDIT: Specifically, I need for $_POST['password'] to match the last four of M2[MSSNO]. This is their SSN. Quote Link to comment Share on other sites More sharing options...
craygo Posted April 8, 2008 Share Posted April 8, 2008 OK try this <?php $sql = "SELECT DISTINCT LH.[Employee Number], 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], DP.[Department] FROM MASTERL2 M2 LEFT JOIN LEAVHST LH ON LH.[Employee Number]=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 WHERE M2.[EMPNO] = '".$_POST['empcode']."' ORDER BY M2.[EMPNO] desc"; echo $sql; // for testing purposes $RESULTDS = mssql_query($sql) or die(mssql_error()); $rows = mssql_fetch_assoc($RESULTDS); // last four of the social security number in database $d_lastfour = substr($rows['MSSNO'], -4); echo "$d_lastfour<br />"; // for testing purposes // format $_POST['password'] $p_lastfour = mysql_real_escape_string($_POST['password']); echo "$p_lastfour<br />"; // for testing purposes if($d_lastfour == $p_lastfour){ // run rest of script } else { echo "passwords don't match"; } ?> Ray Quote Link to comment Share on other sites More sharing options...
Moron Posted April 8, 2008 Author Share Posted April 8, 2008 Let me see if I can break this down into simpler terms. If I run this: $tempnumber = $RESULT['MSSNO']; $ssntest = substr($tempnumber, -4); echo $ssntest; ...it gives me exactly what I'm looking for, the last four of the SSN. But, this only works if I run it after the query. I suppose this is because $RESULT['MSSNO'] doesn't exist until the query is ran. So how can I do a similar technique inside the query, or at least define a function before the query is ran? I suspect that would do what I want. And Ray, thanks a TON for your help so far! Quote Link to comment Share on other sites More sharing options...
craygo Posted April 8, 2008 Share Posted April 8, 2008 Well one of the reasons I suggested that is because mssql may not support substring, but last we can try this for the query $p_lastfour = mysql_real_escape_string($_POST['password']); $sql = "SELECT DISTINCT LH.[Employee Number], 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], DP.[Department], SUBSTRING(M2.[MSSNO], 6, 4) AS `d_lastfour` FROM MASTERL2 M2 LEFT JOIN LEAVHST LH ON LH.[Employee Number]=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 WHERE M2.[EMPNO] = '".$_POST['empcode']."' AND `d_lastfour` = '$p_lastfour' ORDER BY M2.[EMPNO] desc"; Notice I am doing the substring in the select portion and giving it an alias, then comparing the alias to the Post password Ray Quote Link to comment Share on other sites More sharing options...
Moron Posted April 8, 2008 Author Share Posted April 8, 2008 Well one of the reasons I suggested that is because mssql may not support substring, but last we can try this for the query $p_lastfour = mysql_real_escape_string($_POST['password']); $sql = "SELECT DISTINCT LH.[Employee Number], 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], DP.[Department], SUBSTRING(M2.[MSSNO], 6, 4) AS `d_lastfour` FROM MASTERL2 M2 LEFT JOIN LEAVHST LH ON LH.[Employee Number]=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 WHERE M2.[EMPNO] = '".$_POST['empcode']."' AND `d_lastfour` = '$p_lastfour' ORDER BY M2.[EMPNO] desc"; Notice I am doing the substring in the select portion and giving it an alias, then comparing the alias to the Post password Ray Thanks again, but this is error city. Yes, MS SQL supports substr() and I'm using it in several places. It just doesn't seem to like it in a query. Quote Link to comment Share on other sites More sharing options...
Moron Posted April 8, 2008 Author Share Posted April 8, 2008 I guess what it boils down to is.....how can I create a variable that uses data from the query before the query is ran? $_POST['empcode'] ...is the employee's ID number. It's four digits. $_POST['password'] ...is the last four of the employee's SSN. BUT....the database field has the entire SSN (all nine digits). I can easily run substr() on the SSN (M2[MSSNO]), but only after I pull the SSN with the query. Can this be done? It looks almost like a "chicken and egg" riddle. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted April 8, 2008 Share Posted April 8, 2008 I guess what it boils down to is.....how can I create a variable that uses data from the query before the query is ran? Basically what your saying is that you want to get data from the database without running a query. So no, thats not possible. You'll have to use two separate queries Quote Link to comment Share on other sites More sharing options...
Moron Posted April 9, 2008 Author Share Posted April 9, 2008 Thanks for the help, everyone. I suspect that the trick is to incorporate the substr() function into the query itself somehow. Anyway, the problem is solved, but not via PHP; we're going to add another field to the table which lists the last four digits of everyone's SSN. Thanks again! Quote Link to comment Share on other sites More sharing options...
craygo Posted April 9, 2008 Share Posted April 9, 2008 I wish I had mssql so we could get to the bottom of this. To bad you had to circumvent the problem. Ray Quote Link to comment Share on other sites More sharing options...
uniflare Posted April 9, 2008 Share Posted April 9, 2008 Never used ACCESS but can you not use wildcards and LIKE clause in ACCESS? eg: <?php $sql = "SELECT DISTINCT LH.[Employee Number], 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], DP.[Department] FROM MASTERL2 M2 LEFT JOIN LEAVHST LH ON LH.[Employee Number]=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 WHERE (M2.[EMPNO] = '".$_SESSION['empcode']."' and M2.[MSSNO] LIKE '%".$_SESSION['password']."') ORDER BY M2.[EMPNO] desc"; echo $sql; //$RESULTDS = mssql_query($sql) or die(mssql_error()); ?> So obviously the password is always 4 digits. in mysql this would work as long as $password matched at the end of MSSNO string. hope this helps, Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.