-2

Hello i just create my support system and i get ticket detalis with echo but it show all td line as picture i need to show only the first line

Need to remove lines with red

my code

<table cellpadding="0" cellspacing="0" border="0" class="data">
<thead>
<tr>
    <th width="115"><p2>Ticket ID</p2></th> 
    <th width="90"><p2>Status</p2></th>
    <th width="160"><p2>Ticket Topic</p2></th>
    <th width="160"><p2>Client</p2></th>
</tr>
</thead> 
<tr>    <?php
           echo "<td><a href='?page=ticket&id=".$row[id]."'</a>#".$row[id]."</td>";
           echo "<td>".$row[status]."</td>";
           echo "<td>".$row[naslov]."</td>";
            $userr = mysql_query('SELECT * FROM client WHERE clientid='.$row["user_id"].'');
            $useri = mysql_fetch_array($userr);     
           echo "<td><a href='clientsummary.php?id=".$row[user_id]."'</a>".$useri['firstname']." ".$useri['lastname']."</td>";
        ?>
</tr>       

Jeff Puckett
  • 37,464
  • 17
  • 118
  • 167
  • **Then it need quite a bit or rewriting** Please dont use [the `mysql_` database extension](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php), it is deprecated (gone for ever in PHP7) Specially if you are just learning PHP, spend your energies learning the `PDO` database extensions. [Start here](http://php.net/manual/en/book.pdo.php) its really pretty easy – RiggsFolly Jun 09 '16 at 17:22
  • Don't *"roll your own"* eh? @RiggsFolly I myself usually like to know what's "in there" and what being "taken in". ;-) edit: ah, you edited and has lost all its meaning in context. – Funk Forty Niner Jun 09 '16 at 17:23
  • 1
    is this whole code block wrapped inside a loop? move your table header outside the loop. – Jeff Puckett Jun 09 '16 at 17:25
  • yes with include on other php file – Gerald Kacka Jun 09 '16 at 17:26
  • This output seems to me to **depend upon** a query and **loop** we cannot see. **Thats really helpful man** – RiggsFolly Jun 09 '16 at 17:27
  • also, upgrade to [mysqli](http://php.net/manual/en/book.mysqli.php) preferably with the native driver, or [PDO](http://php.net/manual/en/book.pdo.php) – Jeff Puckett Jun 09 '16 at 17:28
  • also, try to make a single query that returns multiple users.. then loop over the returned rows. – Brad Kent Jun 09 '16 at 18:33

1 Answers1

1

you need to move your table header outside the loop. without seeing the mechanics of the loop, I'm guessing it will need to look similar to this:

<table cellpadding="0" cellspacing="0" border="0" class="data">
<thead>
<tr>
    <th width="115"><p2>Ticket ID</p2></th> 
    <th width="90"><p2>Status</p2></th>
    <th width="160"><p2>Ticket Topic</p2></th>
    <th width="160"><p2>Client</p2></th>
</tr>
</thead> 
<tbody>

<?php include 'missing.query.on.other.script.php'; 

while ($row = mysql_fetch_array($whatever_resource)){

?>



<tr>    <?php
           echo "<td><a href='?page=ticket&id=".$row[id]."'</a>#".$row[id]."</td>";
           echo "<td>".$row[status]."</td>";
           echo "<td>".$row[naslov]."</td>";
            $userr = mysql_query('SELECT * FROM client WHERE clientid='.$row["user_id"].'');
            $useri = mysql_fetch_array($userr);     
           echo "<td><a href='clientsummary.php?id=".$row[user_id]."'</a>".$useri['firstname']." ".$useri['lastname']."</td>";
        ?>
</tr>

<?php } // end while ?>

</tbody>
</table>
Jeff Puckett
  • 37,464
  • 17
  • 118
  • 167