( https://i.stack.imgur.com/1LPVk.png )
i mention my link where output show when i press drop-down button
then show empty fields but i have values in my sql table link ( https://i.stack.imgur.com/YEopy.png) but it does
not execute my values in drop down list..i need help...when i show error it does not dispaly any error but show empty in dropdown list..
and my PHP code is:
`

<tr> <td>Country Name</td> <td> <select name="name"> <?php
  $conn = oci_connect("username", "pswrd", "db");
  $sql = 'SELECT name FROM country';
  $stid = oci_parse($conn, $sql);
  $success = oci_execute($stid);
  while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS+OCI_ASSOC)) 
  {
    echo "<option value=\"countryname1\">" . $row['name'] . "</option>";
  }
?> 

`

Dani AI

Generated

's screenshots show the <select> contains <option> entries but no visible labels. That pattern usually means PHP emitted options whose text was an empty string. As already pointed out, common causes are a case-mismatch on the associative key (Oracle column labels are returned uppercase by default), NULL values, or silent failures because errors were suppressed.

Quick, focused checks to diagnose and fix the issue:

  • Enable error reporting and stop suppressing errors so connection/parse/execute problems are visible.
  • Inspect the actual PHP row structure (do not guess the key name) by dumping the fetched row.
  • Try a numeric fetch to avoid associative-key case issues and confirm where the data actually lives.
  • Confirm the script is connected to the same schema that holds the table (or that the user has SELECT rights).
  • Avoid hard-coding the option value; use the real id or column for the value and the name for the label.

Example temporary debug (wrap in blank lines as shown):

error_reporting(E_ALL);
ini_set('display_errors', 1);

/* temporary debug: fetch one row as numeric and inspect */
$row = oci_fetch_array($stid, OCI_NUM);
var_dump($row); // check $row[0] for the country name

If var_dump shows the name in a numeric index, use the numeric index or fetch mode (OCI_NUM) while building options, or alias the column with a quoted identifier so the associative key matches the expected case. Removing any '@' error suppression will make further problems obvious.

Recommended Answers

All 12 Replies

Method oci_fetch_array() will return all rows. Change to oci_fetch_assoc()

still my drop down list emty display

Try to handle other errors

    <tr> <td>Country Name</td> <td> <select name="name"> <?php
      $conn = @oci_connect("username", "pswrd", "db");
      $e = oci_error();
      if($e){
        exit($e['message']);
      }

      $sql = 'SELECT name FROM country';
      $stid = @oci_parse($conn, $sql);
      if(!$stid){
        $e = oci_error($conn);
        exit($e['message']);
      }
      $success = @oci_execute($stid);
      if(!$success){
        $e = oci_error($conn);
        exit($e['message']);
      }
      while ($row = oci_fetch_assoc($stid)) 
      {
        echo "<option value=\"countryname1\">" . $row['name'] . "</option>";
      }
    ?>

Are dropdown list fill by empty options or list is empty?

php code display list empty

https://i.stack.imgur.com/HUwMb.png this is my sql data in table. and i ll display name of column in this table in php code in drop-down list

Try echo "<option value=\"countryname1\">" . $row['NAME'] . "</option>";
Oracle DB usually return column names in upper case

yeah i ll already try this but nothing is change in output

how i solve this dropdown list display problem? i need help

Try echo "<option value=\"countryname1\">" . $row[(array_keys($row)[0])] . "</option>";

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.