Page 1 of 1

Problem while execute the Query

Posted: Tue Apr 22, 2008 4:31 am
by sujithfem
Hi,
I have a problem especially executing the query, I hope the problem due to special Character, i am using the ADOB for DB

Code: Select all

, Language is PHP, i have enclosed the function which make me hazard …….


[syntax=php] 
define('QRY_ALTER_CATEGORY', 'ALTER TABLE Category ADD %s');
 
 function ChangeCategory($FieldName) {
       $Condition = $FieldName.' VARCHAR(20)';
       $Query = sprintf(QRY_ALTER_CATEGORY,$Condition);
       $this->core->DBConn->Execute($Query);
    }
 [/syntax]



The above Function used to Alter the Table Field name  ,the problem is : if the Filed name is "Special character [íóÓéèÉÈÚúáàÁÀãñÑÖöÜüßÉ]” means the query is not execute other wise its works  well ,please let me know the solution for the problem ,and expecting positive reply and advance thanks the same.

Re: Problem while execute the Query

Posted: Tue Apr 22, 2008 5:29 am
by onion2k
Try backticking the field name ... eg

Code: Select all

ALTER TABLE Category ADD `%s`

Re: Problem while execute the Query

Posted: Tue Apr 22, 2008 6:37 am
by sujithfem
yes thanks a lot for your reply
works fine after change the following Code
$Condition = '`' . $FieldName. '`' . ' VARCHAR(20)';

Re: Problem while execute the Query

Posted: Tue Apr 22, 2008 6:38 am
by sujithfem
yes thanks a lot for your reply
works fine after change the following Code
$Condition = '`' . $FieldName. '`' . ' VARCHAR(20)';