Welcome Guest, Not a member yet? Register   Sign In
Problem with model
#11

[eluser]Aken[/eluser]
Are you retrieving the content from the database before processing the update?

Consider performing a redirect to the same page after performing the update. It'll automatically refresh for you, and if the user hits refresh it will not resubmit the form submission another time.
#12

[eluser]Razvan V[/eluser]
[quote author="Aken" date="1350083392"]Are you retrieving the content from the database before processing the update?

Consider performing a redirect to the same page after performing the update. It'll automatically refresh for you, and if the user hits refresh it will not resubmit the form submission another time.[/quote]

That's not my problem.

I insert the data in the database in an administration section.

One page of my website shows the data form the database.
If i insert data in the database(and the page that shows data is loaded), and click the menu link that goes to the function that gets the data, the new post isn't shown.

Only by a refresh does the data show.

How i see my problem: The browser keeps the previous data and dose't show the new one. (at least that sounds like a potential problem)

Any idea how do i fix this?
#13

[eluser]Techno Heart[/eluser]
post your controller have to see what you have done there.
#14

[eluser]Razvan V[/eluser]
The Function in my controller
Code:
public function biography() {
  
  $this->load->model('biography');
  $date['content'] = $this->biography->getEntries();

  $this -> load -> view('website/biography', $date);
}

The funtion in the model:
Code:
function getEntries() {
  $i = 0;
  $query = $this -> db -> query("SELECT * FROM biografie ORDER BY data DESC");
  foreach ($query->result() as $row) {
   if ($i % 2 == 0) {
    $this -> continut .= '
    <div id="bioleft">
    <div class="bioheader_' . $row-&gt;id_categorie .   '">
      <h1 class="biofloat2">' . $row -> titlu . '</h1>
    </div>
    <div class="rightline2">
     <p class="dreapta"><strong>' . $row -> subtitlu . '</strong></p><br /><br />';

    if ($row -> rol != '') {
     $this -> continut .= '<p class="dreapta"><strong>' . $row -> rol . '</strong></p><br />';
    }
    if ($row -> continut != '') {
     $this -> continut .= ' <p class="dreapta"><i>' . nl2br($row -> continut) . '</i></p>';
    }

    if ($row -> rol != '') {
     $this -> continut .= '<p class="dreapta">' . nl2br($row -> descriere) . '</p>';
    }

    $this -> continut .= '</div>
    </div>';
    $i++;
   } else {
    $this -> continut .= '
    <div id="bioright">
    <div class="bioheader2_' . $row-&gt;id_categorie .   '">
      <h1 class="biofloat">' . $row -> titlu . '</h1>
    </div>  
      <div class="rightline">
      <p class="stanga"><strong>' . $row -> subtitlu . '</strong></p><br />';

    if ($row -> rol != '') {
     $this -> continut .= '<p class="stanga"><strong>' . $row -> rol . '</strong></p>';
    }
    
    if ($row -> continut != '') {
     $this -> continut .= '<p class="stanga"><i>' . nl2br($row -> continut) . '</i></p> ';
    }
    if ($row -> descriere != '') {
     $this -> continut .= '<p class="stanga">' . nl2br($row -> descriere) . '</p>';
    }
        
    $this -> continut .= '</div></div>';
    $i++;
   }
  }

  return $this -> continut;
}


The View has a:
Code:
<div>
&lt;?php echo $content; ?&gt;
</div>

Again the problem if i refresh the page (f5) it updates if i acces my function via link
Code:
www.example.com/index.php/controller/biografie
it dosent refresh...
#15

[eluser]Razvan V[/eluser]
As you can see I'm not doing anything spectacular there, that is my problem i'm doing something simple and it doesn't work right.

Does CodeIgniter save the results of a function at it's first access and then is shows old data?





Theme © iAndrew 2016 - Forum software by © MyBB