CodeIgniter Forums
generated paste - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: generated paste (/showthread.php?tid=46917)



generated paste - El Forum - 11-20-2011

[eluser]Unknown[/eluser]
Hello,
I would write such a paste generated. I have [form]
my controller:
Code:
foreach($this->sp_model->select() as $r)
            {
                          
                echo $this->sp_model->p_form($r->body,$r->id_form );
                
          }
my model
Code:
function get_form()
    {
        $this->db->where('id_u',$this->session->userdata('username'));
        
        $w1= $this->sp_model->select();
        foreach($w1 as $f)
        {
    $form = $f->id_form;
        }
        
        $this->db->where('id',$form);
        $qw = $this->db->get('form');
        return $qw->result();
      
    }
    function p_form($msg, $id)
    {
        $this->db->where('id_u', $this->session->userdata('username'));
        $this->db->limit(1);
        $qw = $this->db->get('sp');
        $qw->result();
        
        $w1= $this->sp_model->get_form();
        foreach($w1 as $f)
        {
    $form = $f->form;
        }
        $msg=str_replace("[form]",$form,$msg);
  return $msg;
    }
How to do it for more of such paste?