I have one problem .
$criteria->addCondition(‘telephone LIKE’. $_GET[‘tel’]. ‘%’);
this addCondition is not working
public function view()
$criteria->addCondition('telephone LIKE'. $_GET['tel']. '%');
return new CActiveDataProvider('Contact', array(
Looks like there is no space between LIKE and the value… is there? Are you debugging the output?
Also you can do the same thing by doing:
$criteria->compare('telephone', $_GET['tel'], true);
Pardon me if this is just a transcription error in pasting here, but it looks like you have a whitespace/quotes error in your condition:
should read as (note the space after LIKE):
$criteria->addCondition('telephone LIKE '. $_GET['tel']. '%');
and assuming you’re on a MySQL backend, you also need to use quotations when comparing strings, so it’s actually going to be
$criteria->addCondition('telephone LIKE `'. $_GET['tel']. '%`');
otherwise it will look for a column name that matches your $_GET[‘tel’]% string.
I want to match first 6 digit. is that possible