\Phpcmf\Service::M()->db->query("UPDATE '".$this->prefix."1_news' as a,'".$this->prefix."1_wgone' as b SET b.updatetime ='2020-12-1' where a.id=b.cid");报错,哪里错了呢?CRITICAL - 2020-12-07 15:11:43 --> Using $this when not in object context#SQL:SELECT *FROM `dr_cron`WHERE `id` = 50#URL:http://172.16.12.19/admin.php?c=cron&m=do_add&id=50#AGENT:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 UBrowser/6.2.4098.3 Safari/537.36#REFERER:http://172.16.12.19/admin.php?c=cron&m=index
\Phpcmf\Service::M()->db->query("UPDATE '".$this->prefix."1_news' as a,'".$this->prefix."1_wgone' as b SET b.updatetime =unix_timestamp(NOW()) where a.id=b.cid");我改时间格式了,还是报错!
\Phpcmf\Service::M()->db->prefix(); $sql="UPDATE '".$this->prefix."1_news' as a,'".$this->prefix."1_news_form_tet' as b SET b.qy =unix_timestamp(NOW()) where a.id=b.cid"; \Phpcmf\Service::M()->db->query($sql);CRITICAL - 2020-12-07 15:57:21 --> Call to undefined method CodeIgniter\Database\MySQLi\Connection::prefix()
$sql="UPDATE '".\Phpcmf\Service::M()->db->prefix."1_news' as a,'".$this->prefix."1_news_form_tet' as b SET b.qy =unix_timestamp(NOW()) where a.id=b.cid";十楼的方法啊
$sql="UPDATE '".\Phpcmf\Service::M()->db->prefix."1_news' as a,'".$this->prefix."1_news_form_tet' as b SET b.qy =unix_timestamp(NOW()) where a.id=b.cid"; $rt = \Phpcmf\Service::M()->db->query($sql);if ($rt) { // 成功} else { //失败 echo \Phpcmf\Service::M()->db->error();}还是这个错误提示CRITICAL - 2020-12-07 16:40:50 --> Using $this when not in object context
$sql="UPDATE '".\Phpcmf\Service::M()->db->prefix."1_news' as a,'".\Phpcmf\Service::M()->db->prefix."1_news_form_tet' as b SET b.qy =unix_timestamp(NOW()) where a.id=b.cid"; $rt = \Phpcmf\Service::M()->db->query($sql);if ($rt) { // 成功} else { //失败 echo \Phpcmf\Service::M()->db->error();}ERROR - 2020-12-07 16:48:37 --> 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 ''1_news' as a,'1_news_form_tet' as b SET b.qy =unix_timestamp(NOW()) where a.id=' at line 1#SQL:UPDATE '1_news' as a,'1_news_form_tet' as b SET b.qy =unix_timestamp(NOW()) where a.id=b.cid
UPDATE test.dr_1_news as a,test.dr_1_news_form_tet as b SET b.qy =unix_timestamp(NOW()) where a.id=b.cidUPDATE '1_news' as a,'1_news_form_tet' as b SET b.qy =unix_timestamp(NOW()) where a.id=b.cid你对比啊,少了什么,长度都不一样了,而且还多了‘号
$sql="UPDATE test.dr_1_news as a,test.dr_1_news_form_tet as b SET b.qy =unix_timestamp(NOW()) where a.id=b.cid"; $rt = \Phpcmf\Service::M()->db->query($sql);if ($rt) { // 成功} else { //失败 echo \Phpcmf\Service::M()->db->error();}我用原数据库名称放进去都报错,提示执行失败?为啥啊?数据库里是成功的!
$sql="UPDATE dr_1_news as a,dr_1_news_form_tet as b SET b.qy =unix_timestamp(NOW()) where a.id=b.cid";
$rt = \Phpcmf\Service::M()->db->query($sql);
if ($rt) {
// 成功
} else {
//失败
echo \Phpcmf\Service::M()->db->error();
}
同意十楼的观点
先去phpmyadmin工具里面运行一下吧