用PHP删除Oracle数据库中的一条数据,删不掉,紧急!
<?php
$connection = OCILogon ("username", "passwd", "SSID");
if (!$connection){
echo "Unable to connect:" . var_dump( OCIError() );
exit;
}
import_request_variables("gp","p_");
if($p_submit=="Delete")
{
for($i=0; $i< sizeof($p_product); $i++)
{
if(isset($p_product[$i]))
{
$query="delete from Products where Product_ID=$p_product[$i]";
$cursor = OCIParse ($connection, $query);
if(!$cursor) {
echo "Unable to connect:" . var_dump( OCIError() );
exit;
}
}
$result=OCIExecute($cursor, OCI_DEFAULT);
if(!$result) {
echo "Unable to connect:" . var_dump( OCIError($cursor) );
exit;
}
}
}
OCIFreeStatement($cursor);
OCILogoff($connection)
?>
SQL在oracle里测试时是正确的,但是在PHP文件里虽然显示执行无误,但是别没有真的删除了数据,请问这是为什么?
code中$p_product是一个数组,其值是Product_ID,请给位指点!多谢了!~