View difference between Paste ID: bhzCzVR1 and iaY16rZA
SHOW: | | - or go back to the newest paste.
1-
Como fica:
1+
<?php
2-
<select>
2+
3-
<option value="andreia maria manuel a b c etc">andreia maria manuel a b c etc</option>
3+
$con = pg_connect("host=localhost dbname=aveiro port =5432 user=pedro password=****");
4
5
$query = "SELECT DISTINCT rua AS nome,n_rua AS id FROM ruas";
6-
Como deveria ficar:
6+
7-
<select>
7+
$result = pg_query($con,$query);
8-
  <option value="andreia">Andreia</option>
8+
9-
  <option value="maria">Maria</option>
9+
pg_close($con);
10-
  <option value="manuel">manuel</option>
10+
11-
  <option value="etc">etc</option>
11+
?>
12-
</select>
12+
13
14
<!DOCTYPE html>
15
<html>
16
<body>
17
18
<h1>Testes</h1>
19
20
21
22
<select name="rua">
23
    <?php
24
    while ($line = pg_fetch_array($result)) {
25
        echo '<option value="' . $line['id'] . '">' . $line['nome'] . '</option>';
26
    }
27
    ?>
28
</select>
29
30
31
32
33
34
35
</body>
36
</html>