I have a problem using the oci_execute function in php. I start by initialising my query then oci_parse it and then oci_execute it. Everything works fine. And data are being inserted or modified in my database. The problem is that these data are inserted randomly. If I have a query like this
INSERT INTO RESTITUTIONS (id_agence, num_immatriculation, num_client, km_restitution, km_parcouru, etat, date_restitution, prix)
VALUES(4, '307VXN78', 1002, 20010, 10, 'BON', to_date('10/10/2010', 'DD.MM.YYYY'), NULL)
It inserts the values in the database only that it doesn't insert them correctly. For example instead of inserting 4 at the first column, it inserts 2 or 3 or 5(any number randomly). It changes at each time I run mu php file. Another problem is the date. It doen't insert the right date. From the query, the dtae is the 10-OCT-2010. But it inserts any random date. Here is my code:
$id = $_POST['agence'];
$immatricul = '\'' . $_POST['vehicule'] . '\'';
$client = $_POST['client'];
$km_par = $_POST['km_parcouru'];
$date = $_POST['date'];
$query = 'INSERT INTO RESTITUTIONS (id_agence, num_immatriculation, num_client, km_restitution, km_parcouru,
etat, date_restitution, prix)
VALUES(' . $id . ', ' . $immatricul . ', ' . $client . ', ' . $km_restitution . ', ' . $km_par . ', \'BON\',
to_date(\'' . $date . '\', \'DD.MM.YYYY\'), NULL)';
echo'<p>' . $query . '</p>';
$state = oci_parse($conn, $query);
if (oci_execute($state, OCI_COMMIT_ON_SUCCESS)) {
echo '<p>Restitution effectue!!!!</p>';
} else {
echo '<p>false</p>';
}
Any ideas as to how I can rectify this problem? Thanks.