Grasper
Grasper

Reputation: 1313

PHP fetch_row limits the result

I have a table with the rows but for some reason it populates only 14 rows. I have around 800 rows in the db. Any ideas?

code:

$result = mysqli_query($con,"SELECT * FROM translation ORDER BY id");


while($row = mysqli_fetch_row($result) and $property = mysqli_fetch_field($result))
  {    

    echo "<tr>";
   foreach($row as $column => $value) {
        // $column is column name 'englsih', 'spanish' etc.
        $name = $property->name;        

        echo "<td align='left' class='cell".$column."'>". $value . "</td>";             
    }    
    echo "<td><span class='edit_b'></span><span class='remove_b'></span></td></tr>";    
  }
  echo "</thead></table>";

Upvotes: 0

Views: 53

Answers (1)

jeroen
jeroen

Reputation: 91734

I assume your translation table has 14 columns?

The problem is this:

... and $property = mysqli_fetch_field($result) )

You are fetching information about the columns in your result-set - and not even using it - and as soon as you have passed the last column, this will return false and your loop will end.

Don't fetch information about the columns in the same loop as your main results loop.

Upvotes: 3

Related Questions