W
W
winzerofox2016-12-17 11:54:40
PHP
winzerofox, 2016-12-17 11:54:40

Outputting text from MySQL to a php page?

Outputting text from MySQL to a php page ? There are three values ​​in MySQL (highlighted in red lines in the picture), how to display them separately one by one? Since all three are displayed. There is a ready-made solution, but it displays all three.

<?php foreach ($attribute_groups as $attribute_group) { ?>
  <?php foreach ($attribute_group['attribute'] as $attribute) { ?>
    <?php echo $attribute['text']; ?><br>                 
   <?php } ?>
<?php } ?>

7cc935ef6b8e40d7822e2a0f5585e4dd.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
O
Orbb, 2016-12-17
@winzerofox

so foreach displays everything for you.
Collect the output in an array and output by key, for example, or link the text itself to attribute_id.
In general, it would be nice to formulate the question well.

V
Viktor Yanyshev, 2016-12-17
@villiwalla

echo $attribute['text']['0'] etc

V
Vadim, 2016-12-17
@kylt_lichnosti

I propose to read the beginning of some book on php. It's about loops and arrays. And everything will fall into place.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question