Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hello all,

I have a script,m but it has 3 records in the database, but it only shows me
one record, Why? Its counts 2 but doiesnt show 3. whats wrong here?

$query = "Select count(*) from ervaring" ;
   $result = mysql_query($query);
    $query_data = mysql_fetch_row($result);//     Haal de gegevens uit de
    $total_num_user = $query_data[0];

        echo "geen ervaringen!";
    } $page_num = $cur_page + 1;//  Paginanummer teller
    $total_num_page = $last_page_num
    = ceil($total_num_user/$records_per_page);

 echo "$total_num_user ervaringen gevonden.
        Page $page_num van $last_page_num.\n";

        $cur_page = 0;//
    $limit_str = "order by datum desc LIMIT ". $cur_page * $records_per_page
.. ",
    $records_per_page";//   Limiteer de hoeveelheid gegevens per pagina

  $query = "Select * from ervaring $limit_str" ;
   $result = mysql_query($query);

    while($query_data = mysql_fetch_array($result)){

        $naam  = $query_data["naam"];
        $leeftijd  = $query_data["leeftijd"];
        $ervaring = $query_data["ervaring"];
  $datum = $query_data["datum"];

 ?> <table border=0 cellpadding=2 cellspacing=1 bordercolor=#2B5728>
echo " <tr>\n";

echo "<tr> <td bgcolor=FFECC4><p>Naam:</td><td bgcolor=FFECC4><p> $naam
echo "  <tr><td bgcolor=FFECC4><p> Leeftijd:</td><td bgcolor=FFECC4><p>
$leeftijd </td></tr>";
echo "  <tr> <td bgcolor=FFECC4><p>Datum:</td><td bgcolor=FFECC4><p>
echo " <tr> <td bgcolor=FFECC4><p>Ervaringen:</td><td bgcolor=FFECC4><p>
$ervaring </td></tr> <p>";

echo "  </tr>";

Re: Problem

Irlan agous wrote:
Quoted text here. Click to load it

Because you loop through the resultset without showing anything:

Quoted text here. Click to load it

And then, when the loop is finished, you echo just the last row:

Quoted text here. Click to load it

Solution: put the "echo"s inside the "while"-loop.


Real e-mail address unavailable. 5000+ spams per month.

Site Timeline