-
-
Save nomaanp/750f328669f1b8f91957 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Table desc | |
Address Table = 'addr' | |
States Table = 'states' | |
City Table = 'city' | |
Addr_Category Table = 'addr_category' | |
In Model | |
$sql1 = new Sql($this->dbAdapter); | |
$selct = new Select(array('a' => 'addr')); | |
$selct->join(array('f'=>'states'),'f.id = a.state_id',array('state_name' => 'name')) | |
->join(array('d'=>'city'),'d.id = a.city_id',array('city_name' => 'name')) | |
->join(array('e'=>'addr_category'),'e.id = a.cat_id') | |
->order('a.name'); | |
$selectString = $sql1->getSqlStringForSqlObject($selct); | |
$result = $this->dbAdapter->query($selectString,DbAdapter::QUERY_MODE_EXECUTE); | |
In view script | |
On edit and delete link, it is returning the addr_category's id instead of addr's id | |
<a href="<?php echo $this->url('address/edit', array('action' => 'edit', 'id' => $address->id)); | |
?>"><img src="../public/img/edit.png" alt="Edit"/></a> | |
<a href="<?php echo $this->url('address/delete', array('action' => 'delete', 'id' => $address->addrid)); | |
?>"><img src="../public/img/delete.png" alt="Delete"/></a> |
Actuallly for delete link it is $address->id and definition for addr_category is id,caname
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Mohammad,
In the view script snippet in your Gist, did you intend to have
$address->id
for edit but$address->addrid
for delete? It seems you're referring to two different columns here. Also, can you add a definition of the addr_category table (though shouldn't be specifically necessary)?Matt