查询语句中可否用php变量?????

wangyoucao1234 2003-12-07 11:46:26
查询语句: $temp_table_name=$e_lurudanwei."_".$sub_name[$i][$k];
$query="select ".$sub_name[$i][$k]." from ".$temp_table_name;

调用函数出错:
$num_of_sub_kind[$i]=num_of_subs_getting($query);


function num_of_subs_getting($query)
{

$connection=ora_logon("feng@bnyypkxt","feng");
$cursor= ora_open($connection);
ora_commitoff($connection);
if (!(ora_parse($cursor,$query) or die))
{ return "-1";
exit;}

if (! (ora_exec($cursor)))
{ return "0";
exit;
}
$result=array();
while(ora_fetch_into($cursor,$result))
{

$data.=$result[$i]."!#$%";



}

ora_close($cursor);
ora_logoff($connection);
return $data;
}
错误:
Warning: Ora_Parse failed (ORA-00911: 无效字符 -- while processing OCI function OPARSE) in d:\newfile\bnyypkxt20030713\web\cgi\luru_main.php on line 559
...全文
52 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ustcfrank 2003-12-07
  • 打赏
  • 举报
回复
上面的错了

$temp_table_name=$e_lurudanwei."_".$sub_name[$i][$k];

$s_n_i_k=$sub_name[$i][$k];

$query="select '$s_n_i_k' from '$temp_table_name'";
ustcfrank 2003-12-07
  • 打赏
  • 举报
回复
$query="select ".$sub_name[$i][$k]." from "$temp_table_name;

21,891

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧