I have a simple bit of code:
:ul1 = 0;
$sql = "SELECT word FROM tbl WHERE 1 = 1 AND catid > :ul1 ORDER BY RAND() LIMIT 3";
$stmt1 = $pdo->prepare($sql1);
$stmt1->bindParam(':ul1', $ul1);
$stmt1->execute();
$row1 = $stmt1->fetchAll();
var_dump($row1);
That outputs:
array(3) {
[0]=>
array(2) {
["word"]=>
string(8) "arrochar"
[0]=>
string(8) "arrochar"
}
[1]=>
array(2) {
["word"]=>
string(7) "cabinet"
[0]=>
string(7) "cabinet"
}
[2]=>
array(2) {
["word"]=>
string(10) "doghearted"
[0]=>
string(10) "doghearted"
}
}
I can access an array element via:
$test = $row1[2][0];
I wondered if there is any way I can get a more simple array output - e.g. each array element seems to contain the same thing twice.
Not that it matters - I can still do what I need to do, I was just curious.