Problem while execute the Query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sujithfem
Forum Newbie
Posts: 23
Joined: Tue May 23, 2006 10:56 pm
Location: India
Contact:

Problem while execute the Query

Post 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.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Problem while execute the Query

Post by onion2k »

Try backticking the field name ... eg

Code: Select all

ALTER TABLE Category ADD `%s`
sujithfem
Forum Newbie
Posts: 23
Joined: Tue May 23, 2006 10:56 pm
Location: India
Contact:

Re: Problem while execute the Query

Post by sujithfem »

yes thanks a lot for your reply
works fine after change the following Code
$Condition = '`' . $FieldName. '`' . ' VARCHAR(20)';
sujithfem
Forum Newbie
Posts: 23
Joined: Tue May 23, 2006 10:56 pm
Location: India
Contact:

Re: Problem while execute the Query

Post by sujithfem »

yes thanks a lot for your reply
works fine after change the following Code
$Condition = '`' . $FieldName. '`' . ' VARCHAR(20)';
Post Reply