php - Get all id's from table MYSQL -


i'd echo id's user table can't work. tried below , searched stacks can't find right answer.

        $query = $db->query( "select * users" );         $num   = $db->num( $query );         while( $array = $db->assoc( $query ) ) {             $active_ids = $array['id'];         }          $query = "select u.username, u.habbo, count(*) n          users u, timetable tt          u.id=tt.dj , u.id in (".$active_ids.")         group tt.dj";          $result = $mysqli->query($query);          if ($result->num_rows > 0) {             while($row = $result->fetch_assoc()){                 echo "<tr id='uren-table-row'>";                 echo "<td width='60px'><div style='height:50px;padding-top:25px;overflow:hidden;float:left;margin-top:-25px;'><img style='margin-top:-28px;float:left;' src='http://habmoon.org/moonstream/dj?habbie={$row['habbo']}&amp;head_direction=3&amp;direction=2&amp;size=b&amp;hb=img&amp;gesture=sml'></div></td>";                 echo "<td width='200px' style='padding:0 15px;'>", $row['username'] ,"</td>";                 echo "<td style='padding:0 15px;'>heeft <b>", $row['n'] ,"</b> uur gedraait deze week</td>";                 echo "</tr>";             }         } 

you need make $active_ids csl. overwrite id(s) on every iteration getting last one. need separated commas use implode. try:

while( $array = $db->assoc( $query ) ) {             $active_ids[] = (int)$array['id'];  }  $active_ids = implode(',', $active_ids); 

Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -