Created
August 30, 2019 13:55
-
-
Save jalbertbowden/92ea31ee6b8f2bbee463a5ca48dbb85a to your computer and use it in GitHub Desktop.
ms sql thinks i'm a douchbag.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(scheduleAgencyLocalityVar === 4){ // state agency | |
jsonSchedulesURIVar = 4; | |
jsonSchedulesURIVar = jsonSchedulesURIVar.toString(); | |
queryFor = "state"; | |
} else if(scheduleAgencyLocalityVar === 5){ // locality/entity | |
jsonSchedulesURIVar = 5; | |
jsonSchedulesURIVar = jsonSchedulesURIVar.toString(); | |
queryFor = "locality"; | |
} | |
var sqlStatementSchedules = "'SELECT DISTINCT SchedNum, SchedTitle FROM RM3_Schedules WHERE FK_SCHEDULE_TYPE_ID = "+jsonSchedulesURIVar+" OR FK_AGENCY_LOCALITY_ID = "+htmlSelectAgenciesValue+" ORDER BY SchedTitle;'"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$dumb_test = 'SELECT DISTINCT SchedNum, SchedTitle FROM RM3_Schedules WHERE FK_SCHEDULE_TYPE_ID = 4 OR FK_AGENCY_LOCALITY_ID = 364 ORDER BY SchedTitle;'; | |
$stmt_dumb_test = sqlsrv_query($conn, $dumb_test); /* submit query to open connection */ | |
if( !$stmt_dumb_test ) { | |
echo '<p>Error executing <code>get_departments</code> query.</p>'; /* catch/display/query error message */ | |
die( print_r( sqlsrv_errors(), true)); | |
} | |
/* iterate through table rows populating the array */ | |
do { | |
while ($row = sqlsrv_fetch_array($stmt_dumb_test, SQLSRV_FETCH_ASSOC)) { | |
$jsonDumb[] = $row; | |
} | |
} while ( sqlsrv_next_result($stmt_dumb_test) ); | |
$jsonDumbEcho = json_encode($jsonDumb); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment