tags:

views:

24

answers:

1

Hi,

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....

A: 

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
Is there a way I can match values without creating a column to hold the value?
Angela
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