Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $conn = pg_connect("host=db.fe.up.pt dbname=siem1624 user=siem1624 password=JgcTjkCo");
- if (!$conn) {
- print "ERRO: Nao foi possivel estabelecer ligacao ร base de dados";
- exit;
- }
- $query = "set schema 'SIEM';";
- pg_exec($conn, $query);
- $ordem = $_GET['ordem'];
- if ($ordem) { $query = "select * from encomendas where idencomenda>0 order by ".$ordem.";"; }
- else $query = "select * from encomendas where idencomenda>0 order by idencomenda;";
- $result = pg_exec($conn, $query);
- pg_close($conn);
- echo "<form method='GET' action='apagaencomenda.php'>";
- echo "<table width=700px border=1>";
- echo "<tr bgcolor= #75a9e5>";
- echo " <th>Nรบmero <a href='encomendas.php?ordem=numero'>๐ผ<a><a href='encomendas.php?ordem=numero desc'>๐ฝ</th>
- <th>Cliente <a href='encomendas.php?ordem=idcliente'>๐ผ<a><a href='encomendas.php?ordem=idcliente desc'>๐ฝ</th>
- <th>Estado <a href='encomendas.php?ordem=estado'>๐ผ<a><a href='encomendas.php?ordem=estado desc'>๐ฝ</a></th>
- <th>Valor <a href='encomendas.php?ordem=valor'>๐ผ<a><a href='encomendas.php?ordem=valor desc'>๐ฝ</a></th>
- <th>Oferta <a href='encomendas.php?ordem=oferecer'>๐ผ<a><a href='encomendas.php?ordem=oferecer desc'>๐ฝ</a></th>";
- echo "<th>Apagar</th>";
- echo "</tr>";
- $num_linhas = pg_numrows($result);
- $i = 0;
- while ($i < $num_linhas) {
- $row = pg_fetch_row($result, $i);
- $row[3]=$row[3]." โฌ";
- if($row[4]==t) {$row[4]="Sim";} else {$row[4]="Nรฃo";}
- $username=
- echo "<tr>";
- echo " <td>".$row[1]."</td>
- <td>".$row[5]."</td>
- <td>".$row[2]."</td>
- <td>".$row[3]."</td>
- <td>".$row[4]."</td>";
- if($_COOKIE['admin']==t)
- {
- echo"<td>
- <a href='acoes/apagaencomenda.php?id=".$row[0]."'>
- <input style='color: red;' type='button' value='X'></input>
- </a>
- </td>";
- }
- echo "</tr>";
- $i++;
- }
- echo "</table>";
- echo "</form>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement