Page 1 of 1

problem searching and display using php with oracle

Posted: Wed Jun 09, 2004 8:42 pm
by kanpp
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.


###################### Retrieve data from database ##################

Code: Select all

<?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

Code: Select all

<?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 --->http://www.geocities.com/whiteshiroi/search_view.txt,
If u cannot view, please right click and click view source.


[edit] feyd - added [php.] tags. viewtopic.php?t=21171

Posted: Wed Jun 09, 2004 8:49 pm
by feyd
although not familiar with oracle queries and interfaces, looks like a problem with OCIParse()

Posted: Wed Jun 09, 2004 9:25 pm
by kanpp
there are problem with this command searching can't do dynamicaly

Code: Select all

<?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); 
          

?>
[edit] feyd - added [php.] tags. viewtopic.php?t=21171 Please read that