2

So I'm storing some XML in a table, and using the MySQL 'COMPRESS' function like this:

$query = "SELECT UNCOMPRESS(table_row) FROM database WHERE this = 'that'";
$mysqli = $this->ConnectDB();
$result = $mysqli->query($query);
$task_result = $task->fetch_assoc();

This works of course, but it renames the key within the returned associative array from 'table_row' to 'UNCOMPRESS(table_row)'.

Is there a way to prevent this renaming?

Anirudh Ramanathan
  • 46,179
  • 22
  • 132
  • 191
jbrain
  • 561
  • 3
  • 7
  • 18
  • Just add an alias to the expression in the SELECT list. `SELECT UNCOMPRESS(table_row) AS table_row FROM `. Whatever alias you assign in the SQL text is what MySQL will return in the resultset metadata. – spencer7593 Jul 16 '12 at 20:04

1 Answers1

2
$query = "SELECT UNCOMPRESS(table_row) AS table_row 
          FROM database WHERE this = 'that'";
Yan Berk
  • 14,328
  • 9
  • 55
  • 52