htmlspecialchars() expects parameter 1 to be string, array given C:\xampp\htdocs\yii\framework\web\helpers\CHtml.php(98)
The error only occurred when trying to apply the echmultiselect filter to the filter above the gridview.
Here’s what I did to fix:
Went to the Yii framework folder and found the following file: yii\framework\web\helpers\CHtml.php
Modified line 98 from return htmlspecialchars($text,ENT_QUOTES,Yii::app()->charset); to: return htmlspecialchars(print_r($text, true),ENT_QUOTES,Yii::app()->charset);
Then you need to implement the echmultiselect extension in the view (my example shows adding it for site_status):
Added this php code to the view: $data= CHtml::listData(MyModel::model()->findAll(), 'blahblahblah', 'blahblahblah'); (but it should probably be in the model)
Made my ‘columns’ array look like this:
'columns'=>array('id','blah','blahblah',array('name'=>'blahblahblah','filter'=>$this->widget('ext.EchMultiselect.EchMultiselect',array('model'=>$model,'dropDownAttribute'=>'blahblahblah','data'=>$data,'options'=>array('buttonWidth'=>80,'ajaxRefresh'=>true),),true// capture output; needed so the widget displays inside the grid),),array('class'=>'bootstrap.widgets.TbButtonColumn',),),
I’ve had issues with queries failing and leaving connections open (enough to stall a server…). I know python’s oursql library supports using the WITH keyword, and I think it will close the connection when there is an unexpected error. However, I’m not sure if I’m ready to move to a different library for MySQL (it’s working well).
Here’s what I’m currently doing to close the cursor and connection, then re-raise the error:
importMySQLdbconn=MySQLdb.connect(user="username",passwd="secret",db="database",charset='utf8')cur=conn.cursor()try:cur.execute("INSERT INTO testTable (userid) VALUES(%s);"%id)conn.commit()except:cur.close()conn.close()raisefinally:print"Insert Successful"
Bootstrap is on every new site lately. Start Bootstrap has a bunch of free templates built on it, handy for grabbing a layout instead of starting a page from scratch.
I was able to to the following, based on the post above:
sudo apt-get install sysv-rc-conf
sudo sysv-rc-conf
mark the 6 column for mysqld or mysql.server (6 = reboot)
Note: I tried sudo update-rc.d mysql.server defaults and it didn’t work. It gave me the following error: System start/stop links for /etc/init.d/mysql.server already exist.