2
I am trying to create a loop with PDO where I can choose the desired field to position it on the page. But the code I’m using is bringing all the fields at once.
My code is like this:
include("libraries/conn.php");
$sql = "SELECT
content.id_content,
content.img,
content.titulo,
povos.pv,
cat.categoria,
content.inicio,
content.fim,
content.content,
regiao.reg,
regiao.wmap
FROM cat
INNER JOIN regiao
INNER JOIN povos
INNER JOIN content ON povos.id_povos = content.civ
AND regiao.id_regiao = povos.regiao
AND cat.id_cat = content.clas
ORDER BY rand()";
$result = $PDO->query( $sql );
$rows = $result->fetchAll(PDO::FETCH_ASSOC);
print_r( $rows );
The result is coming like this:
Array ( [0] => Array ( [id_content] => 31 [img] => paleozoica.jpg [title] => Paleozoic Era [Pv] => Indefinite [category] => Architecture and Housing [start] => -550000000 [end] => -250000000 [content] => The Paleozoic era prevailed from 550 to 250 million years ago. In this period the terrestrial surface has undergone great transformations§ãµes, among them are the emergence of mountain ranges such as the Scandinavian Alps (Europe). Essa era geológica também se caracteriza mpela ocorrência de rochas sedimentares e metamórficas, formação de grandes florestas, glaciações, surgimento dos primeiros insetos e répteis. [reg] => World [wmap] => world.jpg )
I brought all the columns you selected. What would be the result you expected to get?
– Woss