UndefinedReference
UndefinedReference

Reputation: 1253

PHP Drop Down List Populated By Oracle Database Rows

I'm getting an empty drop down list while trying to populate it with values from an Oracle 10G website.

The drop down list appears, but there are no values inside of it. I also have error reporting on, but am not getting any errors.

Can anyone point out my error?

<tr>
  <td>Unit List</td>
    <td>
      <select name="unit">
          <?php 
              $conn = oci_connect("user", "password", "db");
              $sql = 'select ORGANIZATION_NAME from organization@something';
              $stid = oci_parse($conn, $sql);
              while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS+OCI_ASSOC))
              {
                  echo "<option value=\"unit1\">" . $row['ORGANIZATION_NAME'] . "</option>";
              }
          ?>
      </select>
    </td>
</tr>

Upvotes: 0

Views: 3095

Answers (1)

Rafael
Rafael

Reputation: 2817

You're not executing the query, after parsing the query you need to execute it before fetching the results, the function you need is oci_execute(), used like this:

$success = oci_execute($stid)

Upvotes: 1

Related Questions