The problem id from the table using php to do so?

0 like 0 dislike
3 views
Started to learn the output of news, wrote the code:
<?phpif (!$Module or $Module == 'main') {$Pm1 =R::getAssoc('SELECT * FROM news ORDER BY id DESC LIMIT 6');}foreach ($Pm1 as $Row) {echo '<a href="/news/material/id/'.$Row[id].'">ID news:'.$Row['id'].' |Added by: '.$Row['author'].' | '.$Row['data'].'  | '.$Row['name'].''; } ?>

Displays all fields except the id.
Wrote a small script to generate the news. Code:
<?php$n = rand(11,100000);$i = 1;while ($i <= 5){$new = R::dispense('news');$new->name = 'Zagalovok '.$i; $new->author ='User'.$i; $new->text ='Text'.$n; $new->data = date("d m Y"); R::store($new); $i++; } header('Location:/news'); ?>


Array ( [7] => Array ( [name] => Zagalovok 5 [author] => User5 [text] => Text54433 [data] => 04 05 2018 ) [6] => Array ( [name] => Zagalovok 4 [author] => User4 [text] => Text54433 [data] => 04 05 2018 ) [5] => Array ( [name] => Zagalovok 3 [author] => User3 [text] => Text54433 [data] => 04 05 2018 ) [4] => Array ( [name] => Zagalovok 2 [author] => User2 [text] => Text54433 [data] => 04 05 2018 ) [3] => Array ( [name] => Zagalovok 1 [author] => User1 [text] => Text54433 [data] => 04 05 2018 ) [2] => Array ( [name] => Zagalovok 1 [author] => User1 [text] => Text5891 [data] => 04 05 2018 ) )

What could be the problem?
by | 3 views

1 Answer

0 like 0 dislike
Generally replaced R::getAssoc on R::getAll. Now the array includes absolutely all fields, including id.
by

Related questions

110,608 questions
257,186 answers
0 comments
33,863 users