Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7832165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:04:25+00:00 2026-06-02T12:04:25+00:00

I want to know how to fetch single row from Oracle in PHP? Chedck

  • 0

I want to know how to fetch single row from Oracle in PHP?

Chedck my script-:
I want to fetch single row from ITEM_INFO table & compare that values with variables $sku & $code…Logic I applied which works in Mysql but not working in Oracle…

Each time $sku & $code contains diff. values so I just need to compare them with ITEM_INFO table & if it’s matches then update the flag for the same…

$query_fetch = "SELECT ITEM_NAME,SITE_CODE FROM app.ITEM_INFO WHERE ITEM_FLAG = 'N'";
$stmt = oci_parse($conn,$query_fetch);
oci_execute($stmt);
while(($row = oci_fetch_array($stmt, OCI_BOTH))) 
{   
    $ITEM_NAME = ($row["ITEM_NAME"]);                       
    $SITE_CODE = ($row["SITE_CODE"]);   

    if(($ITEM_NAME === $sku) && ($SITE_CODE === $code))
    {   
              $query_ora_update = "UPDATE app.ITEM_INFO SET ITEM_FLAG= 'Y', LAST_UPDATE_DATE = sysdate WHERE ITEM_NAME = '$sku' AND SITE_CODE = '$code' AND ITEM_FLAG = 'N' ";
                                            $parse_result = oci_parse($conn,$query_ora_update);
    $result = oci_execute($parse_result);
    oci_commit($conn);
    oci_close($conn);
    }
 }

plz guide me…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T12:04:26+00:00Added an answer on June 2, 2026 at 12:04 pm

    Basically, you just have to remove the while loop.

    Here’s a rewrite of your code applying that change (+ you use too many parenthesis, decreasing your code readability + you should use SQL binding to avoid injection):

    $query_ora_update = "UPDATE app.ITEM_INFO SET ITEM_FLAG= 'Y', LAST_UPDATE_DATE = sysdate WHERE ITEM_FLAG = 'N'";
    $parse_result = oci_parse($conn, $query_ora_update);
    $result = oci_execute($parse_result);
    
    oci_commit($conn);
    oci_close($conn);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey guys i want to fetch 3 tables in 1 single ado.net call from
hello friends i just want to know that whether we can access or fetch
When I am fetching the row it not fetch array I want to know
I want to know how to capitalize in PHP
I want to know how to echo a string that have a $ sign
I want to fetch a branch from a remote, but my branch name does
I have a search field, and using that single text box I want the
I need to have a single row of data printed out through php. So,
I am using php with Mysql. I want to know what really is wrong
i only want to know that whether data is available for any specific date

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.