Jump to content

How To Get Specific Rows From Result Object


JustinK101

Recommended Posts

I came up with this. Any better way?

 

$start_row = 2;
$end_row = 6;

$temp_rows = array();
$rows = array();

while($row = mysqli_fetch_object($result_obj)) {
     $temp_rows[] = $row;
}

for($i = $start_row; $i < $end_row; $i++) {
     $rows[] = $temp_rows[$i];
}

print_r($rows);

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.