( 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>";
  }
?> 

`

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

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.