thinkphp 3.2 視圖模型 產生的SQL語句提示 1267異常 求指點

來源:互聯網
上載者:User
thinkphp 3.2 視圖模型 產生的SQL語句提示 1267錯誤 求指點~
用的TP3.2 視圖模型 查詢
模型裡是這樣寫的
PicViewModel.class.php
namespace Home\Model;
use Think\Model\ViewModel;
class PicViewModel extends ViewModel{
public $viewFields =array(
'Picture'=> array('picTitle','picToken','picCategroy','picAuthor','picPostTime','_as'=>'Picture'),
'PictureAttachment' =>array('pictureid','pictureurl','creattime','_on'=>'Picture.picToken = PictureAttachment.pictureid','_as'=>'PictureAttachment'),


);
}

控制器這樣寫
  public function  Pic(){
$PicModel =D('PicView');
$s1= $PicModel->field('picTitle,picCategroy,picAuthor,picPostTime,pictureurl')->order('picPostTime desc')->select();
dump($PicModel->getLastSql());
dump($s1);

}

產生的SQL 陳述式是這樣的
SELECT Picture.picTitle AS picTitle,Picture.picCategroy AS picCategroy,Picture.picAuthor AS picAuthor,Picture.picPostTime AS picPostTime,PictureAttachment.pictureurl AS pictureurl FROM xxx_picture Picture  JOIN xxx_picture_attachment PictureAttachment ON Picture.picToken = PictureAttachment.pictureid ORDER BY Picture.picPostTime desc

在phpmyadmin裡運行出現
MySQL 返回: 文檔

#1267 - Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '='
這個應該是定序不同 然後我在phpmyadmin裡直接修改表的
改成一樣是utf8_general_ci,了 還是報錯

網上查了是這樣執行
alert xxx_picture_attachment CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci
ALTER xxx_picture_attachment DEFAULT CHARACTER SET utf8_general_ci
貌似也不行額
報錯
MySQL 返回: 文檔

#1064 - 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 'alert xxx_picture_attachment CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_' at line 1

求大神指點下啊
------解決思路----------------------
貼出表結構看看
  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.