Jump to content
Sign in to follow this  
kanpp

Searching Guna Oracle Dan Php

Recommended Posts

tolong erk sesapa yang boleh membantu dalam menyelesaikan masalah nih..sbb aku dah penin... huh.gif

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.

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

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

Share this post


Link to post
Share on other sites

field Resv_Id kat dalam oracle ni numeric format atau char format. try buat single quote tu..

good luck.

Step.

Share this post


Link to post
Share on other sites

try this one

$search = "SELECT LIABILITIES.LIAB_ID FROM LIABILITIES,EMPLOYEE

WHERE EMPLOYEE.STAFF_ID = LIABILITIES.STAFF_ID AND EMPLOYEE.STAFF_ID=" + $staff_id + ";"

aku bukan pro PHP tapi ader la pernah tengok issue cam ni.

sometimes seba single quote, double quote or semicolon jer kor punyer program fail kekekekkeeke

step.

Share this post


Link to post
Share on other sites

okeh thank guys rasanya problem dah solve sebabnya semua variable yang dalam php tak boleh sama kena unik berbeza laa..so kena laa letak tukar jadi staff_id1 ke apa2 untuk kita passing kat variable...so nih pengajaran yang aku dpt...kena tukar...rupa2nya simple jerk sampai aku rasa nak pecah kepala...rupa itu jerk...okeh...mekasih sesapa yang tolong..erk...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...