php - SQLSTATE[42000]: Syntax error or access violation? on a custom generated code -


ok, know there several such questions asked, case different.

this mysql query trying execute.

alter table `test`.`that` drop foreign key `fk_that_new`;  alter table `test`.`that` add constraint `that_new_fk` foreign key `that` (`col45`) references `new` (`column 1`) on update restrict on delete restrict; 

the query generated through code. when used same query through heidisql workbench, query runs fine, executes , gives me result, while using through code throws me exception error

sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mariadb server version right syntax use near 'alter table test.that add constraint that_new_fk foreign key that (`col4' @ line 1

bottom note : language used php, db engine used : pdo. tried using use db command still negative result.