Advertisement
Guest User

Untitled

a guest
Nov 7th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. <?php
  2. $conn = pg_connect("host=db.fe.up.pt dbname=siem1624 user=siem1624 password=JgcTjkCo");
  3. if (!$conn) {
  4. print "ERRO: Nao foi possivel estabelecer ligacao ร  base de dados";
  5. exit;
  6. }
  7.  
  8. $query = "set schema 'SIEM';";
  9. pg_exec($conn, $query);
  10.  
  11. $ordem = $_GET['ordem'];
  12. if ($ordem) { $query = "select * from encomendas where idencomenda>0 order by ".$ordem.";"; }
  13. else $query = "select * from encomendas where idencomenda>0 order by idencomenda;";
  14.  
  15. $result = pg_exec($conn, $query);
  16.  
  17. pg_close($conn);
  18.  
  19. echo "<form method='GET' action='apagaencomenda.php'>";
  20.  
  21. echo "<table width=700px border=1>";
  22. echo "<tr bgcolor= #75a9e5>";
  23. echo " <th>Nรบmero <a href='encomendas.php?ordem=numero'>๐Ÿ”ผ<a><a href='encomendas.php?ordem=numero desc'>๐Ÿ”ฝ</th>
  24. <th>Cliente <a href='encomendas.php?ordem=idcliente'>๐Ÿ”ผ<a><a href='encomendas.php?ordem=idcliente desc'>๐Ÿ”ฝ</th>
  25. <th>Estado <a href='encomendas.php?ordem=estado'>๐Ÿ”ผ<a><a href='encomendas.php?ordem=estado desc'>๐Ÿ”ฝ</a></th>
  26. <th>Valor <a href='encomendas.php?ordem=valor'>๐Ÿ”ผ<a><a href='encomendas.php?ordem=valor desc'>๐Ÿ”ฝ</a></th>
  27. <th>Oferta <a href='encomendas.php?ordem=oferecer'>๐Ÿ”ผ<a><a href='encomendas.php?ordem=oferecer desc'>๐Ÿ”ฝ</a></th>";
  28. echo "<th>Apagar</th>";
  29. echo "</tr>";
  30.  
  31. $num_linhas = pg_numrows($result);
  32. $i = 0;
  33. while ($i < $num_linhas) {
  34.  
  35. $row = pg_fetch_row($result, $i);
  36.  
  37. $row[3]=$row[3]." โ‚ฌ";
  38.  
  39. if($row[4]==t) {$row[4]="Sim";} else {$row[4]="Nรฃo";}
  40. $username=
  41.  
  42.  
  43. echo "<tr>";
  44. echo " <td>".$row[1]."</td>
  45.  
  46. <td>".$row[5]."</td>
  47. <td>".$row[2]."</td>
  48. <td>".$row[3]."</td>
  49. <td>".$row[4]."</td>";
  50. if($_COOKIE['admin']==t)
  51. {
  52. echo"<td>
  53. <a href='acoes/apagaencomenda.php?id=".$row[0]."'>
  54. <input style='color: red;' type='button' value='X'></input>
  55. </a>
  56. </td>";
  57. }
  58. echo "</tr>";
  59.  
  60. $i++;
  61. }
  62. echo "</table>";
  63.  
  64.  
  65. echo "</form>";
  66. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement