2

I want to convert following sql query to zend query. How I can convert this mysql query into zend query with zend framework 2?

select * from user where BINARY username = "testUser";

Thanks

Tanner
  • 22,205
  • 9
  • 65
  • 83
Ishan
  • 191
  • 1
  • 1
  • 9
  • Possbile answer you were searching http://stackoverflow.com/questions/10153740/tool-that-convert-mysql-query-to-zend-framework-query – knkarthick24 Oct 10 '14 at 09:52

2 Answers2

1

Did you tried this:

$select = $select->where('username' => new \Zend\Db\Sql\Expression("BINARY('testUser')"));
0

Here how you can write your query in Zend:

$select = $db->select()
             ->from('user')
             ->where('BINARY username = ?', "testUser");
Danis
  • 1,978
  • 3
  • 16
  • 27
  • Thanks. But this code it not working in zend framework 2 :( . This is ok with Zend framework 1. – Ishan Oct 14 '14 at 04:18