generate a pull-down list from database

From: Date: Fri, 07 Jul 2000 23:06:25 +0000
Subject: generate a pull-down list from database
Groups: php.general 
Request: Send a blank email to php-general+get-5475@lists.php.net to get a copy of this message
Hello, I am trying to generate a pull-down list from a database. Here is my code. It assumes a successful logon to the database (which it indeed does) and a form. <html><body><form bla bla bla> '<select name="select" size="1"> <? query = "select field1, field2 from table where valid_source = 'Y'"; $cursor = OCIParse ($connection, query); if ($cursor == false){ echo OCIError($cursor)."<BR>"; exit; } $result = OCIExecute ($cursor); if ($result == false){ echo OCIError($cursor)."<BR>"; exit; } while (OCIFetchInto ($cursor, $column)){ $id = $column[0]; $text = $column[1]; echo "<option value=$id>$text</option>"; } echo "</select>"; ?> </form></body></html> If I run this exact query directly on the database, I get 3 rows back. When php runs this query, it gets only one row back, or at least it runs its FetchInto routine as if there's only 1 row. If I run the query with the WHERE clause taken out, I get 2 rows instead of 3. This is using Oracle 8.1.6, FYI I'm at a loss. Ideas? -- Paul Fernandez Webmaster Structural GenomiX, Inc.

« previous php.general (#5475) next »