0

I have connected a oracle database with PHP. When I try to query a data in sqlplus it works. But when I try to query in PHP, it doesn't work(It doesn't show any error or nothing). My emp_id is number.

        <p> $query = "select order_id from ordered_by where order_emp_id =".$emp_id."and order_done='N'";

        $stid = oci_parse($conn, $query);

        $r = oci_execute($stid, OCI_DEFAULT);

        $value="";

        while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) 

        {

            foreach ($row as $item) 

            {

                $item!== null ? htmlentities($item) :'NULL';

                $value =$item;



            }
3
  • 2
    What does the meaning of "it does not work ?" An error appear ? Commented Apr 1, 2014 at 8:55
  • try attaching the schema name to the where clause like schema_name.ordered_by Commented Apr 1, 2014 at 8:57
  • your "emp_id" is string or int? Commented Apr 1, 2014 at 9:00

1 Answer 1

2

Put a space after =".$emp_id."

$query = "select order_id from ordered_by where order_emp_id =".$emp_id." and order_done='N'";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.