Jump to content

[SOLVED] how to check what the number is


nathanmaxsonadil

Recommended Posts

Yes it looks like I did, but I actually meant = and not <= at the time... but now I can see I misunderstood him.

 

I thought of "before the 3rd row to echo something" as "to echo something between the 2nd and 3rd row" - but of course (maybe) he want to highlight the 3 highest scores or something like that.

Yes it looks like I did, but I actually meant = and not <= at the time... but now I can see I misunderstood him.

A single = would have been even more wrong in this context.

 

it puts it on everyline before the 4th one now

<?php
  $i = 0;
  while($row = mysql_fetch_assoc($result)){
    if($i == 4){
      // Rows 1 - 3
    }
    $i++;
  }
?>

 

Are you just blindly copying and pasting code or are you making any attempt to understand what's happening here?

Yes, I forgot a =, it should have been ==.

 

If you mean / meant between 2nd and 3rd row you can use something like my first code, just correct the = to ==

 


<?php

$i = 1;

while($row = mysql_fetch_array($gettopfour))

    if($i == 3) {
      echo 'something before the 3rd row';
    }
    
    echo $row['something'];

   $i++;

?>

 

This will echo 'something before the 3rd row' before the third row...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.