Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.50 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to save Line-breaks in DB and display them in View with Zend Framework
  2. $this->escape($entry->description)'
  3.        
  4. echo nl2br($entry->description)
  5.        
  6. $db = Zend_Db_Table::getDefaultAdapter();
  7. $db->insert('testing', array('description' => "This is a testnwith multiplenlines in the dbnnmore stuff"));
  8.  
  9. $select = $db->select()->from('testing');
  10. $results = $select->query();
  11. $row     = $results->fetch();
  12.  
  13. $this->view->description = $row['description'];
  14.  
  15. // in the view:
  16.  
  17. echo nl2br($this->description);