Skip to content

Commit

Permalink
Fix MySQL reserved keyword clash
Browse files Browse the repository at this point in the history
Fixes #725
  • Loading branch information
svivian committed Jan 12, 2019
1 parent 113b350 commit 8e9c262
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions qa-include/qa-db.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,9 @@ function qa_db_single_select($selectspec)

$query = 'SELECT ';

foreach ($selectspec['columns'] as $columnas => $columnfrom)
$query .= $columnfrom . (is_int($columnas) ? '' : (' AS ' . $columnas)) . ', ';
foreach ($selectspec['columns'] as $columnas => $columnfrom) {
$query .= is_int($columnas) ? "$columnfrom, " : "$columnfrom AS `$columnas`, ";
}

$results = qa_db_read_all_assoc(qa_db_query_raw(qa_db_apply_sub(
substr($query, 0, -2) . (strlen(@$selectspec['source']) ? (' FROM ' . $selectspec['source']) : ''),
Expand Down

0 comments on commit 8e9c262

Please sign in to comment.