0

Trying to figure out what went wrong, must be a silly syntax.

$objDatabase = QApplication::$Database[1];
$strQuery = 'UPDATE `account` SET `sndx`=SOUNDEX("'.$objAccount->Name.'") WHERE `Id`='.$aid;
$objDbResult = $objDatabase->Query($strQuery);

The error I get is:

MySqli Error: Unknown column 'sndx' in 'field list' Exception Type: QMySqliDatabaseException

There is no sndx column. The intent is to match values in account using SOUNDEX....

skaffman
  • 398,947
  • 96
  • 818
  • 769
Satchel
  • 16,414
  • 23
  • 106
  • 192

1 Answers1

0

Well, you've answered your own question. If there is no sndx column, you can't set a value to it which is why the query fails.

Update your table to have an sndx column.

Simon
  • 37,815
  • 2
  • 34
  • 27
  • Is there a way I can match values without creating a column to hold the value? – Satchel Feb 11 '10 at 23:09
  • You could, but it would be slow - if you store the soundex in a column it can be indexed, otherwise the select will need a full table scan, performing the soundex on a column and your input. i.e WHERE soundex(columnName) = soundex("'. $objAccount->Name.'") – Simon Feb 12 '10 at 10:12
  • @Simon, the data should be properly escaped when sent to SQL – Svetoslav Marinov Jun 11 '22 at 14:30