Welcome Guest, Not a member yet? Register   Sign In
Selecting Data from database[SOLVED]
#1

[eluser]Ivar89[/eluser]
Ok, stupid thing hereTongue, I know how to select Data from database and post it on a page
but When I try to select the date and refere it to a value for a textfield something goes wrong.
controller;
Code:
function edit($id)
    {
        $data['ID_Blog'] = $id;
        $this->db->where('ID_Blog', $id);
        $data['blogs'] = $this->db->select('strBlogTitle, ID_Blog, ID_Language, datPublicationDate, memBlogContent, strBlogKeyword, strBlogDescription, blnPublished, strAuthorName, memBlogIntro,')->get('tblblog')->result();
        $this->load->view('blog/edit', $data);
    }
View;
Code:
<?php echo form_open('blog/save'); ?>
                            <?php foreach ($blogs as $blog): ?>
                              <p id="titleshow"><b>Blog Title:</b></p>
                            &lt;input class="content" id="title" name="strBlogTitle" value="&lt;?php echo $blog-&gt;strBlogTitle; ?&gt;" style="display:none;" type="textfield">
                            <p id="intro"><b>Blog Intro:</b></p>
                            &lt;textarea class="content" id="content0" name="memBlogIntro" value="&lt;?php echo $blog-&gt;memBlogIntro; ?&gt;" style="width:600px; height:100px; display:none;">&lt;/textarea&gt;

It might be a problem that I use $data['ID_Blog'] and $data['blogs'], but not sure
I need the ['ID_Blog'] to update the right row in database..

Weird thing(weird to me);
I DO get the strBlogTitle to show in the textbox but not the memBlogIntro(And the rest of the view code, but thats not relevant) only the first one works:S

any suggestions?

ps: I checked for type's and capitals and they are all correct.
#2

[eluser]Ivar89[/eluser]
OMG!!!!
It was THE MOST moronic thig EVER!!!
textarea's don't have values -_-'
so changed to
Code:
&lt;textarea class="content" id="content0" name="memBlogIntro" style="width:600px; height:100px; display:none;"&gt;&lt;?php echo $blog->memBlogIntro; ?&gt;&lt;/textarea&gt;




Theme © iAndrew 2016 - Forum software by © MyBB