Ignore MySQL foreign key constraints in PHP

前端 未结 4 1570
生来不讨喜
生来不讨喜 2021-02-19 10:17

Is there a way to override mysql foreign key constraints in a php script?

I have a query passed to mysql from php, but it fails a foreign key constraint, is there any wa

4条回答
  •  误落风尘
    2021-02-19 10:56

    mysql_query('SET foreign_key_checks = 0');
    //do some stuff here
    mysql_query('SET foreign_key_checks = 1');
    

提交回复
热议问题