Here's what I got right now:
$results = DB::select('select * from test_table');
$result= json_decode(json_encode($results), true);
$x=0;
try {
while ($x<10)
{
echo $result[$x]['column_A'];
echo " ";
echo $result[$x]['column_B'];
echo "<br>";
$x++;
}
}
catch(exception $e) {
echo $e;
}
which echos out:
179368 3A
176733 3B
686733 3C
178673 3D
168663 3E
937338 3F
936888 58
186335 59
199366 5A
159373 5B
So far I know that I could switch out while
with a for
loop to make things slightly shorter. Is there another method of printing out certain rows that looks better than this?
EDIT: By the way, I'm using Laravel if that means anything.
EDIT 2: So is there a way I could print this out without knowing the names of the columns?
Thanks!