Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Passing a variable
I am trying to run a query through php3. You enter a department number
into the form, and I want the sql to get all of the employee
information in that department. I want the form to assign whatever is
typed in to the variable $pdeptno. Then i want the sql on the post page
to query on whatever $pdeptno is.
I am having trouble getting any output from the table. I hope i was clear in explaining my problem, feel free to ask questions if not.
Thanks in advance
oraq.php3:
<?
print("<HTML><BODY>");
print("<FORM method=post action='oraqpost.php3'>");
printf("%s%s","Department Number: <INPUT type=text name=pdeptno
value='", "'>");
print("<INPUT type=submit>"); print("</FORM>"); print("</TABLE></BODY></HTML>");
oraqpost.php3:
putenv("ORACLE_HOME=/opt/app/oracle/product/8.0.5");
$scott = "scott/tiger_at_chess30.world";
echo "<HTML><PRE>\n";
$conn = ora_logon($scott, $tiger);
$curs = ora_open($conn);
//This is where the SQL script is:
$result = ora_parse($curs, "select * from emp where deptno =
$pdeptno");
$result = ora_exec($curs);
$result = ora_fetch($curs);
ora_parse($curs,"select * from emp where deptno = '$pdeptno'"); ora_exec($curs);
while (ora_fetch($curs))
{ ora_getcolumn($curs,0);
}
--
JESSE KNOLL
--Senior - Ball State University - INDIANA --
jrknoll_at_cwix.com
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Thu Jul 08 1999 - 10:17:57 CDT
![]() |
![]() |