我遇到了以下错误:
Warning: oci_fetch_array(): ORA-24374: define not done before fetch or execute
Warning: oci_execute(): ORA-01008: not all variables bound
所以我有以下代码:
$query = sprintf("SELECT p.id, m.display_name, m.updated_at, group_concat(meta.value) as value, p.path
FROM metadata_custom meta
JOIN page as p on p.id = meta.page_id
INNER JOIN metadata m on p.metadata_id = m.id
GROUP BY p.id
UNION ALL
SELECT m.id, name, m.updated_at, m.account_id, path FROM cascade_publish.file
JOIN metadata m on m.id = cascade_publish.file.metadata_id");
$stid = mysql_query($query);
if(!$stid) {
echo 'error with sql statements';
}
else{
echo 'success';
}
//$r = oci_execute($stid );
$xml_group_data_1 = "";
while ($row = mysql_fetch_assoc($stid))
{
$TimeStamp = $row['updated_at'];
$ID = $row['id'];
$URL = $row['path'];//need to figure this out
$dept = substr($URL,6)."/"; //should find department
$directory = substr($URL,6).".html";
$URL = 'http://www.website.edu/$directory'; //should create URL to compare against
$Audience = $row['value'];
$Department = $dept;//set department = to $dept
//properly set mimetype and filetypes depending on file extension
if(strpos($directory,'.html') || strpos($directory,'.htm') || strpos($directory,'.htmls')){
$FileType = 'HTML content';
$MimeType = 'text/html';
}
else{
$FileType = 'Unknown';
$MimeType = 'Unknown';
}
// for now just try inserting into wcm database during while loop
$stid_check = oci_parse($conn, "INSERT INTO WCM_GSA_FEEDDATA (URL,Audience,Department,MimeType,FileType,TimeStamp) VALUES (:URL, :Audience, :Department, :MimeType, :FileType, :TimeStamp)");
// bind values to the parameters in the parsed sql string
oci_bind_by_name($stid_check, ":URL", $URL);
oci_bind_by_name($stid_check, ":Audience", $Audience);
oci_bind_by_name($stid_check, ":Department", $Department);
oci_bind_by_name($stid_check, ":MimeType", $MimeType);
oci_bind_by_name($stid_check, ":FileType", $FileType);
oci_bind_by_name($stid_update, ":TimeStamp", $TimeStamp);
$r = oci_execute($stid_check);
基本上我传下了这个程序,并且不得不改变一个连接到mysql数据库,因此我一直困扰着试图弄清楚如何重写这个代码以支持oracle连接和mysql连接的错误。在代码之前只使用了一个oracle连接。任何帮助/建议表示赞赏。