php - Can't run INSERT statements on ORACLE with PDO

686

I'm having a really weird problem. I have a Linux server with PHP 7.0.22 and the PDO_OCI extension installed. This server is used in an API that receives SOAP requests and then queries an ORACLE database (11g - which, unfortunatelly, I don't have log access).

I've had a few services running here for a while, all select and update statements. All my queries use prepared statements, transactions and rollback. So far so good. The weird part is that I can't run INSERT statements from PHP. It gives me errorORA-00933: SQL command not properly ended. At first I thought I wasn't using prepared statements correctly, so I wrote the SQL manually and tried to run it from PHP and it gave me the same error. I tried debugging from a trillion different ways, but I can't seem to insert it from there. I even dumped the SQL generated, went to my SQL client and ran it, and it inserted the data correctly (to exclude sql syntax problems).

Can anybody shed any light here? My queries are very simple, likeINSERT INTO table (field1, field2) VALUES (value1, value2);

78

Answer

Solution:

As answered by @Kudu2, there was a semicolon at the end of my statement, and somehow the PHP driver didn't like it. I removed it and it went through.

People are also looking for solutions to the problem: php - A way to add Multiple object operator in a condition

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.