Skip to content
Advertisement

Values are not getting matched while using php with oracle

So i have just started working on PHP with Oracle and I am getting values from user using select option as you can see in HTML file, however when i apply where condition on ‘Job’, it wouldn’t match the values. I have also used ‘upper’ with where condition to avoid case-sensitivity but it wouldn’t work. On the contrary when i apply where condition on ‘deptno’, it works fine. Is there anything I am missing?

JavaScript

emp_info.php

JavaScript

Advertisement

Answer

You may need single quotes to be in the SQL string around the value. But before doing that, read the back half of The Underground PHP and Oracle Manual and do things like use bind variables (for security and performance) instead of doing " where job=$job1". Also check the examples on https://php.net/manual/en/ref.oci8.php (Finally, consider using a NOW doc for SQL).

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement