php and SQL question

php and SQL question

am 14.03.2006 21:49:06 von Steff

Hello everyone,

I've been wasting hours on this and I still don't know what's wrong with my
code.

Can anyone tell me what misses in this code to make the insertion work?

The set up of php apache and oracle is ok. I can select stuff from the db.

I keep on getting this message:

Warning: oci_execute() [function.oci-execute]: ORA-00984:
a column name is not authorised here c:\pageWeb\test.php on line 13

=========================================================




test insert





test insert into db



 



 





value="insert" name="B1">




 







=========================================================


$veg=vegy_name;


$c1=oci_connect("stephane","Stef1975",$bdtest05);

$query="insert into vegetables (name) values ($veg)";

$stmt=oci_parse($c1,$query);

oci_execute($stmt, OCI_DEFAULT);


oci_free_statement($stmt);

oci_close($c1);

?>

=========================================================

thanks for looking!

Re: php and SQL question

am 15.03.2006 06:33:17 von zeldorblat

Steff wrote:
> Hello everyone,
>
> I've been wasting hours on this and I still don't know what's wrong with my
> code.
>
> Can anyone tell me what misses in this code to make the insertion work?
>
> The set up of php apache and oracle is ok. I can select stuff from the db.
>
> I keep on getting this message:
>
> Warning: oci_execute() [function.oci-execute]: ORA-00984:
> a column name is not authorised here c:\pageWeb\test.php on line 13
>
> =========================================================
>
>
>
>
> test insert
>
>
>
>
>
>

test insert into db


>
>

 


>
>

 


>
>

>
>

> value="insert" name="B1">


>

>
>

 


>
>
>
>
>
> =========================================================
>
> >
> $veg=vegy_name;
>
>
> $c1=oci_connect("stephane","Stef1975",$bdtest05);
>
> $query="insert into vegetables (name) values ($veg)";
>
> $stmt=oci_parse($c1,$query);
>
> oci_execute($stmt, OCI_DEFAULT);
>
>
> oci_free_statement($stmt);
>
> oci_close($c1);
>
> ?>
>
> =========================================================
>
> thanks for looking!

Change $veg = vegy_name to $veg = $_POST['vegy_name'] and also put some
single quotes around $veg in your query.