Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php include("query.php"); ?>
- <select name="rua">
- <?php echo queryFunction("name"); ?>
- </select>
- +++++++
- query.php:
- <?php
- function queryFunction($table) {
- $connection = pg_connect(...);
- $query = "SELECT name FROM $table ORDER BY name ASC;";
- $results = pg_query($connection, $query);
- $rows = pg_num_rows($results);
- $string = "name";
- for ($i=0; $i < $rows; $i++) {
- $string = $string . "<option>" . pg_fetch_result($results, $i, 0) . "</option>";
- }
- return $string;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement