zend-frameworkzendx

ZendX Jquery Form Autocomplete


Hi i'm using zendx_jquery_form_autocomplete. I have a mysql database with a table user. User has a ID and a Name. My problem is that i don't know I can do my research in the Name column and have the id of the right row. In the tutorial that i saw there is a research in a array and that work fine but now i shoul pass the id of my research...


Solution

  • Use mysql like operator for your search in rows.

    $param =  $this->_getParam('param'); //send from autocomplete
    
    $result = Zend_Db_Table::getDefaultAdapter()->select()->from('users','user_id')->where('name like =?',"%$param")->query()->fetchAll();