0

like this

enter image description here

now i have this

$sqlci = "SELECT cijena_artikl_inv.iznos, cijena_artikl_inv.typ, cijena_artikl_inv.id_artikl, oberflache_bor.oberflache, starke_bor.starke 
FROM(( oberflache_bor 
    INNER JOIN cijena_artikl_inv ON oberflache_bor.id = cijena_artikl_inv.id_oberflache ) 
    INNER JOIN starke_bor ON starke_bor.id = cijena_artikl_inv.id_starke) 
WHERE cijena_artikl_inv.id_artikl=".$id_artikla;
$resultci = mysql_query ($sqlci);

while($rowci = mysql_fetch_array($resultci)){?>
<? $iznosc1 = $rowci['iznos']/3;
$iznosc = $iznosc1*3.4*1.19;
$iznosc = number_format($iznosc, 2, '.', '');

?>

<div class="opis-povob">
<!-- ober -->
<div id="ober-1">
<div class="ober-1">

    <? echo $rowci['oberflache'] ?>


</div>


</div>
<!-- end ober  -->

<!-- starke  -->
<div id="starke-1">

<div class="starke-1">
<p><? echo $rowci['starke'] ?></p>
<p><? echo $iznosc?> €/qm</p>
</div>



</div>

</div>

<?} ?> 

how can i print one entry from one line only, others print all from mysql

Barmar
  • 741,623
  • 53
  • 500
  • 612
  • 1
    please properly explain your question – Pavan Kumar Oct 26 '19 at 07:19
  • What he gets is all rows from the mysql result are displayed simply one after another. What he wants as result is what he showed on the first picture. in every row the name of the surface and in the second column all available thickness for that surface all together – nbk Oct 26 '19 at 10:13

1 Answers1

0

I set the php up, so that it shows only the name once and then all the thickness one after another.

your DIV structure seems off for a table, but you use css and didn't post the css file, so i realy don't know your final result.

But you should make something like this for your output How to place div side by side

Last point mysql_query is deprecated please read up on https://www.php.net/manual/en/function.mysql-query.php

But again i don't know which php version you are using, else i would have changed the code to PDO and https://www.php.net/manual/de/mysqli.quickstart.prepared-statements.php

You should also take a look at

$sqlci = "SELECT 
            cijena_artikl_inv.iznos
            , cijena_artikl_inv.typ
            , cijena_artikl_inv.id_artikl
            , oberflache_bor.oberflache
            , starke_bor.starke 
          FROM 
            (( oberflache_bor 
            INNER JOIN cijena_artikl_inv 
               ON oberflache_bor.id = cijena_artikl_inv.id_oberflache ) 
            INNER JOIN starke_bor ON starke_bor.id = cijena_artikl_inv.id_starke) 
         WHERE cijena_artikl_inv.id_artikl=".$id_artikla;
 $resultci = mysql_query($sqlci);
 $oldname = ""; 
?>
<div class="opis-povob">
<?php  while($rowci = mysql_fetch_array($resultci)){?>
     <?php 
       $iznosc1 = $rowci['iznos']/3;
       $iznosc = $iznosc1*3.4*1.19;
       $iznosc = number_format($iznosc, 2, '.', '');
       if ($oldname !=  $rowci['oberflache']) 
       {
     ?> 
         <!-- ober -->
        <div id="ober-1">
          <div class="ober-1">
             <? echo $rowci['oberflache'] ?>
          </div>
        </div>
    <!-- end ober  -->
    <?php  } ?>
    <!-- starke  -->
    <div id="starke-1">

      <div class="starke-1">
        <p>
          <? echo $rowci['starke'] ?>
        </p>
        <p>
          <? echo $iznosc?> €/qm</p>
      </div>
    </div>
    <?php  $oldname = $rowci['oberflache']; ?>
<?php  } ?>
</div>
nbk
  • 45,398
  • 8
  • 30
  • 47