Moron Posted August 27, 2007 Share Posted August 27, 2007 The first query: $RESULTDS=mssql_query("SELECT DV.[FY], DV.[EmpNo], DV.[NAME], DV.[EmpNo], M2.[NAMEL], M2.[NAMEF], M2.[NAMEMI], M2.[MSSNO], DV.[DATE OF SERVICE], DV.[^], DV.[sER(D-O-V-H)], DV.[CONSIDER], DV.[REIMBURSE] FROM DentalVisionHearing DV JOIN MASTERL2 M2 ON M2.[EMPNO]=DV.EmpNo WHERE M2.[MSSNO] = '".$_SESSION['password']."' and DV.[FY] = '$fiscal' ORDER BY DV.[FY] desc"); The second query: $RESULTDS=mssql_query("SELECT DV.[FY], DV.[EmpNo], DV.[NAME], DV.[EmpNo], M2.[NAMEL], M2.[NAMEF], M2.[NAMEMI], M2.[MSSNO], DV.[DATE OF SERVICE], DV.[^], DV.[sER(D-O-V-H)], DV.[CONSIDER], DV.[REIMBURSE] FROM DentalVisionHearing DV JOIN MASTERL2 M2 ON M2.[EMPNO]=DV.EmpNo WHERE M2.[MSSNO] = '".$_SESSION['password']."' and DV.[FY] = '$fiscalprevious' ORDER BY M2.[MSSNO] desc"); The first query runs fine. If no records match current fiscal year, then it shows blank data. However.....if the first query pulls no records, then the second one won't, either. ??? Cliffnotes: If a person has matching records for the first query (current fiscal year), then the second query shows their previous fiscal year records just fine. But.... if no records match the first query (current fiscal year), then the second query (previous fiscal year) pulls no records, either, even though I know the records are there. Thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/66892-query-help-please/ Share on other sites More sharing options...
frost Posted August 27, 2007 Share Posted August 27, 2007 Can I ask where you are setting $fiscalprevious and $fiscal? Quote Link to comment https://forums.phpfreaks.com/topic/66892-query-help-please/#findComment-335371 Share on other sites More sharing options...
Moron Posted August 27, 2007 Author Share Posted August 27, 2007 Can I ask where you are setting $fiscalprevious and $fiscal? Those are my own functions (with some help from this board). Our fiscal year runs from July 1 through June 30, so $fiscal is defined as such. $fiscalprevious is $fiscal - 1. Quote Link to comment https://forums.phpfreaks.com/topic/66892-query-help-please/#findComment-335409 Share on other sites More sharing options...
trq Posted August 27, 2007 Share Posted August 27, 2007 If your queries are working dependant on each other than I don't think the problem is with the queries itself, but maybe the logic with which you execute them. Can we see the relevant calls to mssql_query()? Quote Link to comment https://forums.phpfreaks.com/topic/66892-query-help-please/#findComment-335418 Share on other sites More sharing options...
Moron Posted August 27, 2007 Author Share Posted August 27, 2007 Can we see the relevant calls to mssql_query()? All of my calls are made to $RESULT[FIELD]; $RESULT=mssql_fetch_assoc($RESULTDS); Is that what you mean? Quote Link to comment https://forums.phpfreaks.com/topic/66892-query-help-please/#findComment-335456 Share on other sites More sharing options...
Moron Posted August 27, 2007 Author Share Posted August 27, 2007 Maybe this will clarify: This screenshot is with my own info entered. I've used no Dental/Vision/Hearing reimbursement this fiscal year (2008), but I do have records for FY 2007. This next screenshot is of a gentleman who has used some reimbursement this fiscal year. As you can see, if records match in the first query, then the second one runs fine. If not, then the second query pulls nothing. Quote Link to comment https://forums.phpfreaks.com/topic/66892-query-help-please/#findComment-335500 Share on other sites More sharing options...
Moron Posted August 28, 2007 Author Share Posted August 28, 2007 Bump. Anybody? Quote Link to comment https://forums.phpfreaks.com/topic/66892-query-help-please/#findComment-336108 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.