表中的
键列是char(36)utf8_general_ci
//保存没问题
$key_Ad= Yii::app()->db->createCommand('select UUID()')->queryScalar();
$modelAd->key=$key_Ad;
$modelAd->save()
//但是发现问题
$post=Ad::model()->find( "key = :key",array(':key'=>$key_Ad) );
---------------------->错误
CDbException
CDbCommand无法执行SQL语句:SQLSTATE [42000]:语法错误或访问冲突:1064 SQL语法中有错误;查看与您的MySQL服务器版本对应的手册,以便在' key =' 3f837af1-8a16-11e4-b111-00241d5e096e'附近使用正确的语法。限制1'第1行。执行的SQL语句是:SELECT * FROM ad
t
WHERE key =:key LIMIT 1(C:\ xampp \ htdocs \ framework \ db \ CDbCommand.php:543)
0 C:\ xampp \ htdocs \ framework \ db \ CDbCommand.php(415):CDbCommand-> queryInternal(' fetch',Array,Array)#1 C:\ xampp \ htdocs \ framework \ db \ ar \ CActiveRecord.php(1351):CDbCommand-> queryRow()#2 C:\ xampp \ htdocs \ framework \ db \ ar \ CActiveRecord.php(1456):CActiveRecord-> query(Object( CDbCriteria))#3 C:\ xampp \ htdocs \ agahi \ protected \ controllers \ ImageController.php(34):CActiveRecord-> find(' key =:key',Array)#4 C:\ xampp \ htdocs \ framework \ web \ actions \ CInlineAction.php(49):ImageController-> actionUploadImage()#5 C:\ xampp \ htdocs \ framework \ web \ CController.php(308):CInlineAction-> runWithParams(数组)#6 C:\ xampp \ htdocs \ framework \ web \ CController.php(286):CController-> runAction(Object(CInlineAction))#7 C:\ xampp \ htdocs \ framework \ web \ CController.php( 265):CController-> runActionWithFilters(Object(CInlineAction),Array)#8 C:\ xampp \ htdocs \ framework \ web \ CWebApplication.php(282):CController-> run(' UploadImage' )#9 C:\ xampp \ htdocs \ framework \ web \ CWebApplication.php (141):CWebApplication-> runController(' image / UploadIma ...')#10 C:\ xampp \ htdocs \ framework \ base \ CApplication.php(180):CWebApplication-> processRequest ()#11 C:\ xampp \ htdocs \ agahi \ index.php(13):CApplication-> run()#12 {main}