I want to execute a query like the following query in zf2.
SHOW COLUMNS FROM Mytable LIKE 'Mycolumn'
What is the correct way of doing so?
By the way i am using AbstractTableGateway
class.
I do it like this:
Pass it to the chosen class and run something like this:
$sql = "SHOW COLUMNS FROM Mytable LIKE 'Mycolumn'";
$statement = $this->adapter->query($sql);
return $statement->execute();
I know reply on a very old thread, but maybe some one looking for SELECT with LIKE
$this->table = $data['table'];
$select = new Select();
$spec = function (Where $where) {
$where->like('company', '%1%');
};
$select->from($this->table);
$select->where($spec);
$resultSet = $this->selectWith($select);
$resultSet->buffer();
return $resultSet;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With