From e65a393d59bc7242d640a5b17d612a9b67067e2e Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Mon, 2 Apr 2007 07:17:33 +0200 Subject: [PATCH] [svn r11822] Added checks before issuing SQL query --- main/install/update-db-scorm-1.6.x-1.8.0.inc.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main/install/update-db-scorm-1.6.x-1.8.0.inc.php b/main/install/update-db-scorm-1.6.x-1.8.0.inc.php index 735a3dc266..191c3e3603 100755 --- a/main/install/update-db-scorm-1.6.x-1.8.0.inc.php +++ b/main/install/update-db-scorm-1.6.x-1.8.0.inc.php @@ -185,10 +185,14 @@ foreach($courses_id_full_table_prefix_list as $course_code => $db) if($old_parent_chap != 0){ $new_chap = $lp_chap_items[$old_chap]; $new_parent = $lp_chap_items[$old_parent_chap]; - $sql_par_chap = "UPDATE $my_new_lp_item " . + if(isset($new_chap) && $new_chap != '' + && isset($new_parent) && $new_parent != '') + { + $sql_par_chap = "UPDATE $my_new_lp_item " . "SET parent_item_id = $new_parent " . "WHERE id = $new_chap"; - $res_par_chap = api_sql_query($sql_par_chap,__FILE__,__LINE__); + $res_par_chap = api_sql_query($sql_par_chap,__FILE__,__LINE__); + } } } unset($parent_chaps);