oracle php
| From: | Murat SAYGILI | Date: | Thu, 26 Oct 2000 12:54:47 +0000 |
| Subject: | oracle php | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-22127@lists.php.net to get a copy of this message | ||
Hello friends,
Last week I asked question "how can I do update , insert , delete or find
processes on one form and put four buttons and do this."
I solved problem with multiple queries on one file and input parameters from
form and choose query to run from multiple select .
I did it like below
first file,
this is not full example
<HTML>
<TITLE>Goruntuleme Sayfasi</TITLE>
<BODY>
<CENTER>Lutfen tarihleri giriniz.</CENTER>
<P>
<TABLE WIDTH=400><TR>
<form action="test2.php3" method="post">
Choose the process you want: <br>
<select name="process">
<option value="0">update
<option value="1">insert
<option value="2">delete
</select>
Tar1: <input type="text" name="tar1"><br> /*date 1 */
Tar2: <input type="text" name="tar2"><br> /* date 2*/
<input type="submit">
</form>
</TABLE>
</BODY>
</HTML>
<HEAD>
second file
multiple queries
<?php
putenv("ORACLE_SID=nt_demo");
putenv("ORACLE_HOME=/u0/tools/app/oracle/product/8.0.5");
$handle = ora_logon("dps@nt_demo", "dps1991") or die;
$cursor = ora_open($handle);
ora_commitoff($handle);
if ($process==0) {
$query = " SELECT * from x1102sta
where x1102sta.datf between '$tar1' AND '$tar2'
";
}
else $process ==1{
$query = " SELECT * from x1104bab
where x1104bab.datf between '$tar1' AND '$tar2'
";
}
else process ==2{
$query = " SELECT * from x1105tts
where x1105tts.datf between '$tar1' AND '$tar2'
";
}
ora_parse($cursor, $query) or die;
ora_exec($cursor);
echo "<HTML><PRE>\n";
echo "$query\n\n";
$numcols = 0;
while(ora_fetch($cursor)) {
$numcols = ora_numcols($cursor);
for ($column=0; $column < $numcols; $column++) {
$data = trim(ora_getcolumn($cursor, $column));
if($data == "") $data = "NULL";
echo "$data\t";
}
echo "\n";
}
$numrows = ora_numrows($cursor);
echo "\nROWS RETURNED: $numrows\n";
echo "</PRE></HTML>\n";
ora_close($cursor);
?>