zend-framework

How to print exact sql query in zend framework ?

眉间皱痕 提交于 2019-12-17 17:28:34
问题 I have the following piece of code which i taken from model, ... $select = $this->_db->select() ->from($this->_name) ->where('shipping=?',$type) ->where('customer_id=?',$userid); echo $select; exit; // which gives exact mysql query. ..... When i use update query in zend like , $up_value = array('billing'=> '0'); $this->update($up_value,'customer_id ='.$userid.' and address_id <> '.$data['address_Id']); Here i want to know the exact mysql query. Is there any possible way to print the mysql

Zend Framework forms, decorators and validation: should I go back to plain HTML?

情到浓时终转凉″ 提交于 2019-12-17 17:26:58
问题 I am currently working on a pretty large application which contains a lot of forms. Up to this moment, I have always been writing my forms by hand and writing my own validation logic, but I have decided it was about time I started using Zend_Form and it's built-in validation routines. However, I keep stumbling upon more and more problems concerning the (lack of) flexibility caused Zend_Form_Decorator. Simple tasks like adding an extra button to a single input-element become incredibly

Redirect to new page w/ POST data (PHP/Zend)

南楼画角 提交于 2019-12-17 16:32:42
问题 I'm trying to figure out how to redirect to a new page (different application, controller, action) and maintain the current POST data. My app is validating the POST data and if a certain criteria is met, I want to redirect to a different location, but make sure the POST data is passed as POST data to that new page. Here's a rough example: POST /app1/example HTTP/1.1 Host: example.com Content-Type: application/x-www-form-urlencoded Content-Length: 17 var1=foo&var2=bar In my exampleAction (Zend

Zend Framework - Set 'selected' value in select box dropdown list

不问归期 提交于 2019-12-17 16:15:43
问题 I am adding a select element to a Zend_Form instance as follows: $user = $form->createElement('select','user')->setLabel('User: ')->setRequired(true); foreach($users as $u) { if($selected == $u->id) { $user->addMultiOption($u->id,$u->firstname.' '.$u->lastname); //*** some way of setting a selected option? selected="selected" } else $user->addMultiOption($u->id,$u->firstname.' '.$u->lastname); } I have been searching the docs but cannot find a simple way of pre-setting an option of the select

Selecting all fields except only one field in mysql [duplicate]

北城余情 提交于 2019-12-17 16:11:02
问题 This question already has answers here : Closed 6 years ago . Possible duplicate: Select all columns except one in MySQL? I want to know is there a way to select all fields except one field from a table in my database. I know I can describe the field names in the select query. For example: SELECT fieldname1, fieldname2, fieldname3, fieldname4 FROM tablename; But my question is, is there any way to do it in a simple way... Like this SELECT * FROM tablename EXCEPT(fieldname3); I am using MySQL

Redirect to previous page in zend framework

吃可爱长大的小学妹 提交于 2019-12-17 15:27:43
问题 I want to add a redirection URL to my login forms action (as a query) in login page, so after loging-in, one can visit the previous page he or she was surfing. First I thought about using Zend Session and save the url of each page in a variable. but I read in the documentation that it has overhead. So, is there a better way to do so? or is there an other way to use zend session with no overhead? 回答1: First, you need to grab the original url for the redirection. You can do that by the Zend

Zend Framework Custom Forms with viewScript

会有一股神秘感。 提交于 2019-12-17 14:01:36
问题 I am having some problems working out how to use custom forms in Zend Framework. I have followed various guides but none seem to work. Nothing at all gets rendered. Here is the bits of code that I am trying to use (All code below is in the default module). I have simplified the code to a single input for the test. applications/forms/One/Nametest.php class Application_Form_One_Nametest extends Zend_Form { public function init() { $this->setMethod('post'); $name = new Zend_Form_Element_Text(

Writing a subquery using Zend DB

被刻印的时光 ゝ 提交于 2019-12-17 10:58:14
问题 I am having some problems turning the SQL below into a Zend Db query. $select = ' SELECT s.id, i.id as instance_id, i.reference, i.name, i.sic_code, i.start_date FROM sles s JOIN sle_instances i ON s.id = i.sle_id WHERE i.id = ( SELECT MAX(id) FROM sle_instances WHERE sle_id = s.id ) ORDER BY i.name ASC'; I have got as far as the code before - but Zend Db isn't producing the query correctly. Can any one show me what I missing?? $select = $db->select() ->from('sles', array( 'id', 'instance_id'

populate select from other select value using jquery

穿精又带淫゛_ 提交于 2019-12-17 10:22:27
问题 hi all I have seen many question but no one has fulfilled my thirst. I want to populate select on the basis of one other select. I am using zend framework. I have a select that will select a account and on the basis of that selected id i want to populate other select with values fetched from database based on first selected option. I have first select which is like this <select name='select1'> <option value='1'>accoutn1</option> <option value='2'>accoutn2</option> <option value='3'>accoutn3<

ZF2 - Get controller name into layout/views

删除回忆录丶 提交于 2019-12-17 07:26:49
问题 I know with ZF1 you would retrieve the module/controller name using custom View Helpers that would get the singleton frontController object and get the name there. Using ZF2 as they've abolished alot of the singleton nature of the framework and introduced DI where I've specified aliases for all of my controllers within this module... I can imagine I would get it through accessing the DI or perhaps injecting the current name into the layout. Anyone got any idea how you would do it. I guess