Skip site navigation (1) Skip section navigation (2)

RE: Loading values in from postgreSQL database into a combo box using PHP

From: Wilson Fletcher <wilson(at)mclachlan(dot)com(dot)au>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: RE: Loading values in from postgreSQL database into a combo box using PHP
Date: 2000-03-31 05:16:29
Message-ID: 01BF9B24.1AC04780.wilson@mclachlan.com.au (view raw or flat)
Thread:
Lists: pgsql-sql
I did it this way:

    <?php
        $conn = pg_connect("", "", "", "", "webdb");
        $result = pg_exec( $conn, "     select fname || ' ' ||
                                mnames || ' ' || sname
                                as name
                                from authors" );
        $count = 0;
        $numrows = pg_numrows( $result );
        while ( $count < $numrows ):
            $row = pg_fetch_object ($result, $count);
            $list[$count] = "<OPTION>".$row->name;
            $count++;
        endwhile;
        $items = implode( $list, "\n");
        pg_close( $conn );
        echo "<b>Author :</b> <select name=author>";
        echo "<OPTION SELECTED>".$items."</select><p>\n";
    ?>


Wilson Fletcher

----------
From: 	Jay[SMTP:jmac(at)nemesis(dot)com(dot)au]
Sent: 	Wednesday, 29 March 2000 22:28
To: 	pgsql-sql(at)postgresql(dot)org
Subject: 	[SQL] Loading values in from postgreSQL database into a combo box using PHP

I am trying to find the script commands (in a .php3 file) for reading, say,
all the surnames from an Address Book table and load them into a combo (or
drop-down) box so that the user can choose one and then click on submit
button for some other purpose.

Can someone give me an example of how this is done?

JM



pgsql-sql by date

Next:From: Sarfaraz PatelDate: 2000-03-31 10:56:45
Subject: outer join syntax
Previous:From: Bruce MomjianDate: 2000-03-31 01:43:00
Subject: Re: isnull

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group