Skip to content

Commit 8e9c262

Browse files
committed
Fix MySQL reserved keyword clash
Fixes #725
1 parent 113b350 commit 8e9c262

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

qa-include/qa-db.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,9 @@ function qa_db_single_select($selectspec)
548548

549549
$query = 'SELECT ';
550550

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

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

0 commit comments

Comments
 (0)