K
K
Kirill Gorelov2017-10-17 20:51:46
API
Kirill Gorelov, 2017-10-17 20:51:46

While not iterating over first element of php array?

Guys, I'm displaying data in a loop. But the while loop is not iterating over the first element of the array, what could be wrong?

<?php  while($result = $stmt->fetch()){  ?>
        <article class="tile is-child notification is-primary">
          <p class="title"><?=$result['title']?> - <?=$result['cur']?></p>
          <p class="subtitle"><?=$result['subtext']?></p>
        </article>
<?php } ?>

The request itself.
$stmt = $pdo->query("SELECT * FROM `strategy` WHERE 1");

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan, 2019-08-08
@Starina_js

Hello. Did you manage to figure it out? As I understand it, you can’t get information by the state number, only by the number of the pass itself?

F
FanatPHP, 2017-10-18
@Kirill-Gorelov

The answer is obvious - before while you do an extra fetch somewhere

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question