使用oci_parse和oci_execute [英] Using oci_parse and oci_execute

查看:282
本文介绍了使用oci_parse和oci_execute的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确定这是非常基本的东西,但是我似乎找不到我的错误.

I'm sure this is something very basic but I can't seem to find my error.

我正在尝试执行以下操作...

I'm trying to execute the following...

$c = db_connect();

$email = addslashes($email);

$sql = "SELECT * FROM RUSER WHERE email LIKE '" . $email . "';";
$query = oci_parse($c, $sql) or die(oci_error($c));
$response = oci_execute($query) or die(oci_error($c));

但是我得到oci8 statement Warning: oci_execute(): ORA-00911: invalid character in /path/to/file.php on line 67,其中第67行是分配$response的位置.

but I get oci8 statement Warning: oci_execute(): ORA-00911: invalid character in /path/to/file.php on line 67 where line 67 is where $response is assigned.

所以这意味着$query出问题了,对吗?但是我似乎找不到那将会是什么.原始sql从命令行执行良好.回声get_resource_type($query)给出资源ID ...

So that means there is something wrong with $query right? But I can't seem to find what that would be. The raw sql executes fine from the command line. echoing get_resource_type($query) gives a resource id...

我在做什么错了?

推荐答案

请勿在SQL中包含;. ;不是SQL本身的一部分,它被各种SQL客户端(例如sql * plus)用作分隔符,以标记要发送到服务器的命令的结束.

Do NOT include the ; in your SQL. The ; is not part of SQL itself, its used by various SQL clients (e.g. sql*plus) as a delimiter to mark the end of commands to be sent to the server.

这篇关于使用oci_parse和oci_execute的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆