$tt=$empire->fetch1(“select * from {$dbtbpre}ems_news where title=”.$writer.””);
如果$writer為中文字符,mysql會報錯
1 | You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/xC2/xB7R/xC2/xB7/xE8/x95/xBE/xE6/xA0/xB9' at line 1 |
解決辦法:在雙引號外加上單引號
1 | '".$writer."' |
新聞熱點
疑難解答