php - splitting up my results in my SQL call -


i have hit wall code. select works fine. when either ($_post['art'] == '*') or ($_post['art'] == '*') need parse results in table always.

but possible put in 2 lines every different "art" returns. of "art" same needs in same table.

<?php    //    include 'teams.php';     include 'species.php';      include 'con.php';  function resultat($conn) {          if ($_post['art'] == '*') {             $sql = "select `id`, `nr`, `team`, `art`, `vaegt`, `laengde`, `dato` `indvejninger` order `art`, `vaegt` desc";         }         elseif ($_post['art'] == '') {             $sql = "select `id`, `nr`, `team`, `art`, `vaegt`, `laengde`, `dato` `indvejninger` order `art`, `vaegt` desc";         }         else {             $sql = "select `id`, `nr`, `team`, `art`, `vaegt`, `laengde`, `dato` `indvejninger` `art`=:art order `art`, `vaegt` desc limit 10";             }          $stmt = $conn->prepare("$sql");         $stmt->bindparam(':art', $_post["art"]);         $stmt->execute();          while ($arr = $stmt->fetch(pdo::fetch_assoc)) {             echo "<tr class='notfirst'> <td>" . $arr['nr'] . "</td>";             echo "<td>" . $arr['team'] . "</td>";             echo "<td>" . $arr['art'] . "</td>";             echo "<td>" . $arr['vaegt'] . " kg </td>";             echo "<td>" . $arr['laengde'] . " cm </td>";             echo "<td>" . $arr['dato'] . "</td></tr>";             }         }   ?> 

anybody can how handling that?


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -