Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old June 9th, 2004, 12:17 AM
kanpp kanpp is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 2 kanpp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to kanpp
problem searching and display using php with oracle

Problem

Currently i am creating a system using php that integreate with oracle database.I am
having a problem to display the result that retrieve the data from database When the
user try to search the details of the particular staff.
Below is the coding to retrieve and display the result.

Note: Connecting to the database using OCI8 is successfull.

PHP Code:
###################### Retrieve data from database ##################

<?php
    
if(!empty($do)) {
            
            if(
$do == "staff_id") {                    
                    
$search "SELECT LIABILITIES.LIAB_ID FROM LIABILITIES,EMPLOYEE 
                           WHERE EMPLOYEE.STAFF_ID = LIABILITIES.STAFF_ID AND EMPLOYEE.STAFF_ID='$staff_id'"
;    
                                
            }
            
            
            if(
$do == "staff_name"){
                    
//$search ="SELECT reservation.Resv_Id, reservation.No_PerChild, reservation.Resv_Arri, reservation.Resv_Dept, room.Ro_Type FROM reservation, room WHERE  reservation.Ro_Id=room.Ro_Id and reservation.Resv_Id ='$Resv_Id';";
            
}


                                        
            
$search_result OCIParse($conn,$search);    
                
            
$search_res OCIExecute($search_result);
            

?>


#########################Display the result inside the table!##############################3


<?php
            
while(OCIFetchInto($search_result,$values)) {
            
$Liab_Id=$values[0];
            
?> 
   <tr>
     <td class="td3" ><font class="text"><?php echo $Liab_Id?></font></td>
     <td class="td3" ><font class="text"></font></td>
     <td class="td3" ><font class="text"></font></font></td>
     <td class="td3"><font class="text"></font></td>
     <td class="td3"><font class="text"></font></td>
     <td class="td3"><font class="text"></font></td>
     <td class="td3"><font class="text"></font></td>
     <td class="td3"><font class="text"></font></td>
     <td class="td3"><font class="text"></font></td>
   </tr>
  <tr>
      <td colspan="7" class="td3" ><font class="inlabelcell"><center></center></font><font class="inlabelcell">&nbsp;</font></td>       
      <td class="td3"><Center><div class="labelcell">Total Amount:</div></Center> </td>
      <td class="td3"><font class="inlabelcell"><center>
      </center></font></td>
  </tr>
  <?php
                
}//close for while search_date
            
}//close if statement
?>

</center>
</body>
</html>


##################################################################### 

Bellow is the error messages that display when run this code!

Warning: ociexecute(): supplied argument is not a valid OCI8-Statement resource in c:\program files\apache group\apache\htdocs\searc_only_view.php on line 71

Warning: ocifetchinto(): supplied argument is not a valid OCI8-Statement resource in c:\program files\apache group\apache\htdocs\searc_only_view.php on line 109

Notes: For the full coding --->URL,
If u cannot view, please right click and click view source.

Last edited by pabloj : June 9th, 2004 at 03:14 AM.

Reply With Quote
  #2  
Old June 9th, 2004, 03:17 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,707 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 6 Days 2 h 38 m 50 sec
Reputation Power: 259
I've done some development with Php and Oracle 9.2 using Oracle extension (not OCI) but I hope this code can help:
PHP Code:
<?
$conn 
= @ora_logon("scott@smcdbserver""tiger") or die ('Could not connect.'.ora_error());
$oracur ora_open ($conn);
$statement "SELECT COUNT(*) FROM emp";
$bool ora_parse($oracur$statement0);
if (!
$bool)
    {
        echo 
ora_error();
    }
else
    {
        echo 
"Successfully parsed statement";
        
//after successfully parsed statement we execute the query
        
ora_exec($oracur);
                         
//get the number of columns in the resultset
        
$numcols ora_numcols($oracur);
              while(
ora_fetch($oracur) ){ // while there is a row 
                     
for($i=0;$i<$numcols;$i++){ // go through the columns
                       
echo ora_getcolumn($oracur,$i);         //print the results
                     
}
               }

    }
ora_close($oracur);
ora_logoff($conn);
?>

Reply With Quote
  #3  
Old June 9th, 2004, 09:38 PM
kanpp kanpp is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 2 kanpp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to kanpp
problem with searching

tahnks for the respon.. FYI i'm using OCI because the there are a better than ORA. my problem is that searching command can be displayed only by static the searching not using the interface or $staff_id address reference

<?php
if(!empty($do)) {

if($do == "staff_id") {
$search = "SELECT LIABILITIES.LIAB_ID FROM LIABILITIES,EMPLOYEE
WHERE EMPLOYEE.STAFF_ID = LIABILITIES.STAFF_ID AND EMPLOYEE.STAFF_ID='$staff_id';

}


if($do == "staff_name"){
//$search ="SELECT reservation.Resv_Id, reservation.No_PerChild, reservation.Resv_Arri, reservation.Resv_Dept, room.Ro_Type FROM reservation, room WHERE reservation.Ro_Id=room.Ro_Id and reservation.Resv_Id ='$Resv_Id';";
}



$search_result = OCIParse($conn,$search);

$search_res = OCIExecute($search_result);


?>

the bold text refer to the problem..it only display when i'm state the

WHERE EMPLOYEE.STAFF_ID = LIABILITIES.STAFF_ID AND EMPLOYEE.STAFF_ID='12345'

hope that can somebody help me to solve the problem.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > problem searching and display using php with oracle


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway