Here is my query
In my db the field ‘sub_domain’ is a varchar. Here is the part I can’t figure out. When
is an integer the query works and returns the matching record. When it is a word such as ‘mysub’, then it does not find the matching row and returns a NULL.
Please advise fellers
Does it have anything to do with the way I am using single quotes in my find() ?
You can write this some thing look like this.
$criteria = new CDbCriteria;
$criteria->select = 'id';
$criteria->addCondition("sub_domain LIKE '%sub_domain%'");
$resultSet = Client::model()->find($criteria);
What is wrong with the way I was doing it. It seems as though the query constructed is
WHERE sub_domain = sample_data
Instead of the way I need it, like this
WHERE sub_domain = 'sample_data'
It doesn’t seem to be passing the data as a string to the query. The reason I think so is because if sample_data = 1, then it returns the correct result. But if sample data is “wow”, then it doesn’t find the record.