Current location: Hot Scripts Forums » Programming Languages » PHP » PHP Drop down list Using Oracle


PHP Drop down list Using Oracle

Reply
  #1 (permalink)  
Old 02-18-05, 01:45 PM
RatherSurf RatherSurf is offline
Newbie Coder
 
Join Date: Feb 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Drop down list Using Oracle

I am new here. I have been searching the net for the last couple of days and cant find anything. In php and mysql I can create a drop down list fine. I am having a problem creating a drop down list in php using sql pulling from and oracle db. Can anyone help or tell me where to look....

Thanks in advance,
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 02-18-05, 10:54 PM
wizkid's Avatar
wizkid wizkid is offline
Newbie Coder
 
Join Date: Nov 2004
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
try at php.net.. you might find there what you need:
http://www.php.net/manual/en/ref.oracle.php
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 02-23-05, 02:18 PM
RatherSurf RatherSurf is offline
Newbie Coder
 
Join Date: Feb 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Working Code

Just in case it helps anyone out I have the code that works now.

<form method="GET" action="test.php">
<select name="school_name">
<?
// Connect to DB
$conn = ociLogon("name", "name", "name");

// This is the SQL statement to run
$query = "SELECT * FROM schools order by Name";

// This parses the SQL Statement for use
$statement = OCIParse($conn, $query);

// OCIExecute returns true/false if the query succedded in runnin
// Note that this does *NOT COMMIT* by default, if you are using INSERT/UPDATE/DELETE
if(OCIExecute($statement))
{
// oci_fetch_array() returns the next row from the result set, OCI_BOTH returns tuples as both associative array
// eg, '$row['NAME']' and indexed array, eg $row[1].
// You can also use oci_fetch_assoc() for just an associative array, or oci_fetch_row() for just numeric array
// Oracle returns all field names in UPPERCASE, so your associative array's will be indexed as such as well.

while(OCIFetchInto($statement, $row, OCI_ASSOC))
{
printf("<option value='%s'>%s</option>\n", htmlentities($row['NAME']), htmlentities($row['NAME']));
}
}
?>
</select>
<input type="submit" />
</form>

<?
if($_GET['school_name']){

print "SELECTED SCHOOL WAS: ";
print $_GET['school_name'];
}
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
retrieve information from MYSQL through drop down list minglou PHP 3 04-03-09 10:43 PM
Drop down list change PHP ancdy PHP 5 02-10-05 06:33 AM
Please help the drop down list! minglou PHP 4 08-23-04 10:47 PM
Create List with PHP ...? demnos PHP 6 08-13-04 03:40 PM
month drop down list angela JavaScript 2 03-31-04 03:33 AM


All times are GMT -5. The time now is 07:16 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.