Tuesday 15 November 2011

GET ID FROM URL IN ZEND

JUST USE THE FOLLOWING LINE FOR GET THE REQUEST

If your url like as following and want to get id from url then use this following code

Your url http://business/bic/property/editpicture/id/2

/************************************************/

$request = $this->getRequest();
$id = $request->id;
echo $id;
/***********************************************/

from this you want to delete any item then use following code

/************************************************/

public function deleteAction(){
$request = $this->getRequest();
$id = $request->id;
$db = Zend_Db_Table::getDefaultAdapter();
$db->delete('table_name', array('id = ?' => $id ));
$this->_redirect($url."property");
}
/************************************************/

Item will be deleted if you want to activate and deactivate your field then use the following code

/************************************************/


public function editAction()
{
$request = $this->getRequest();
$id = $request->id;
$userList = new Users();//object
$userList->deleteUser($id);
$this->_helper->redirector('index');
}


/************************************************/


Now your data edit..............

No comments:

Post a Comment