Yii Framework Forum: error in CGridView when search with . ( dot ) or , ( comma ) - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

error in CGridView when search with . ( dot ) or , ( comma ) error in CGridView when search with . ( dot ) or , ( comma ) Rate Topic: -----

#1 User is offline   kiran sharma 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 494
  • Joined: 21-May 11
  • Location:India

Posted 07 April 2012 - 06:07 AM

Hi,

I used CGridView and when i filter with dot or comma character it shows error as,

Error 500: <h1>CDbException</h1>
<p>CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 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 '' at line 1. The SQL statement executed was:


is there any validation or something else as it not throws the error.
Thanks,
Kiran Sharma.
0

#2 User is offline   kiran sharma 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 494
  • Joined: 21-May 11
  • Location:India

Posted 07 April 2012 - 06:27 AM

the error occured only when i filter on type integer value as ( id , no. of days ... )

i.e : when i filter with . ( dot ) it creates query as below and throw error,

SELECT COUNT(*) FROM `xtzTable` `e` join abcTable d on e.xx=d.yy WHERE ID <> 1 AND E_ID = .

( see last character is . (dot) and that might problem )
Thanks,
Kiran Sharma.
0

#3 User is offline   kiran sharma 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 494
  • Joined: 21-May 11
  • Location:India

Posted 07 April 2012 - 07:04 AM

Ya, now its solved.

i use 'dataProvider'=>$model->search() as dataProvider, but the function search in model is not generate by crude, i just created for my own way for customized filter and sorting . i think the problem was somewhere there so i create function as searchModel() what i use same as crude generates and use that as dataProvider ("'dataProvider'=>$model->searchModel()") and it works. now i can filter on special characters.
Thanks,
Kiran Sharma.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users