Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Re: Insert data into oracle database using a PHP form

user2530916Feb 2 2010 — edited Feb 10 2010
Hai its different for me, i want to display a data based on the input from php form. I see and trying your script but it didn't work.

<?php

// just print form asking for name if none was entered
if( !isset($query)) {
echo "<form action=\"$uri\" method=post>\n";
echo "<p>Enter Name: ";
echo "<input type=text size=100 maxlength=200 name=data value=\"$data\">\n";
echo "<br><input type=submit name=submit value=Submit>\n";
echo "</form>\n";
exit;
}
$data=$_POST;
stripslashes($data);

// Select statement
$query = "SELECT * FROM animal WHERE skin=$data";

// connect to Oracle
$username = "xxxxxx";
$paswd = "xxxxxx";
$dbstring = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)".
"(HOST=yyyyyyyy)(PORT=1521))".
"(CONNECT_DATA=(SID=COSC)))";
$db_conn = ocilogon($username, $paswd, $dbstring);

//$stmt = OCIParse($db_conn, $query);
//OCIExecute($stmt, OCI_DEFAULT);
//OCIFreeStatement($stmt);
//OCILogoff($db_conn);

$stmt = OCIParse ($db_conn, $sql);
OCIBindByName ($stmt, ":name", &$data, -1);
OCIExecute ($stmt);
OCIFreeStatement($stmt);
OCILogoff ($db_conn);

?>


Could you please advice me ? whats wrong with that script ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 10 2010
Added on Feb 2 2010
1 comment
2,722 views