aeroswat Posted March 3, 2010 Share Posted March 3, 2010 I am getting about 40-50 more results than what should be displayed. Can't figure out why so i assume this is the cause of the problem. $qry1 = "SELECT StudentNumber FROM tblStudents WHERE isVisual='1' AND (((LENGTH(eyeRight) > 3 AND SUBSTR(eyeRight,4)>199) AND (LENGTH(eyeLeft) > 3 AND SUBSTR(eyeLeft,4)>199)) OR eyeRight IN ('OP', 'FDB', 'NIL', 'LP', 'CF', 'HM', 'VF')) AND SchoolSystem='" . $res0['systemName'] . "'"; $qry2 = "SELECT StudentNumber FROM tblStudents WHERE isVisual='1' AND (((LENGTH(eyeRight) > 3 AND SUBSTR(eyeRight,4)<200) OR (LENGTH(eyeLeft) > 3 AND SUBSTR(eyeLeft,4)<200)) OR eyeRight NOT IN ('OP', 'FDB', 'NIL', 'LP', 'CF', 'HM', 'VF')) AND SchoolSystem='" . $res0['systemName'] . "'"; I run both of these queries and the possible inputs (as far as I know) are any of the following: 20/(some number between 0 and 9999) NIL LP CF OP FDB HM VF Link to comment https://forums.phpfreaks.com/topic/194016-can-anyone-see-where-any-repition-would-occur-in-this-query/ Share on other sites More sharing options...
aeroswat Posted March 3, 2010 Author Share Posted March 3, 2010 I am getting about 40-50 more results than what should be displayed. Can't figure out why so i assume this is the cause of the problem. $qry1 = "SELECT StudentNumber FROM tblStudents WHERE isVisual='1' AND (((LENGTH(eyeRight) > 3 AND SUBSTR(eyeRight,4)>199) AND (LENGTH(eyeLeft) > 3 AND SUBSTR(eyeLeft,4)>199)) OR eyeRight IN ('OP', 'FDB', 'NIL', 'LP', 'CF', 'HM', 'VF')) AND SchoolSystem='" . $res0['systemName'] . "'"; $qry2 = "SELECT StudentNumber FROM tblStudents WHERE isVisual='1' AND (((LENGTH(eyeRight) > 3 AND SUBSTR(eyeRight,4)<200) OR (LENGTH(eyeLeft) > 3 AND SUBSTR(eyeLeft,4)<200)) OR eyeRight NOT IN ('OP', 'FDB', 'NIL', 'LP', 'CF', 'HM', 'VF')) AND SchoolSystem='" . $res0['systemName'] . "'"; I run both of these queries and the possible inputs (as far as I know) are any of the following: 20/(some number between 0 and 9999) NIL LP CF OP FDB HM VF I figured it out I wasn't checking to make sure that the lefteye had one of the string fields. Thanks anyways Link to comment https://forums.phpfreaks.com/topic/194016-can-anyone-see-where-any-repition-would-occur-in-this-query/#findComment-1020980 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.