Skip to content

Instantly share code, notes, and snippets.

@jalbertbowden
Created August 30, 2019 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jalbertbowden/92ea31ee6b8f2bbee463a5ca48dbb85a to your computer and use it in GitHub Desktop.
Save jalbertbowden/92ea31ee6b8f2bbee463a5ca48dbb85a to your computer and use it in GitHub Desktop.
ms sql thinks i'm a douchbag.
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;'";
$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