Opencart v2.2.0을 사용하고 있으며 PHP 스크립트에 문제가 있습니다. 제발 내가 할내 PHP 스크립트의 치명적인 오류
function restoreBackup()
{
global $mysqli;
$i = 0;
$getpic = "SELECT * FROM oc_product_backup LIMIT 0, 100000";
$backup = $mysqli->query($getpic);
$mysqli->autocommit(FALSE);
$updateproduct_sql = "UPDATE oc_product SET image = ?, ean = ?, model = ?, status = ?, price_sync = ?, modified_by = ?, date_modified = ? WHERE product_id= ?";
$updatedescription_sql = "UPDATE oc_product_description SET name = ?, description = ?, meta_description = ?, meta_keyword = ?, tag = ?, modified_by = ? WHERE product_id = ? AND language_id = ?";
$stmt = $mysqli->prepare($updateproduct_sql);
$stmt->bind_param('sssiiiss', $image, $ean, $model, $status, $price_sync, $modified_by, $date_modified, $product_id);
$stmt2 = $mysqli->prepare($updatedescription_sql);
$stmt2->bind_param('sssssisi', $name, $description, $meta_description, $meta_keyword, $tag, $modified_by, $product_id, $language_id);
while($row = $backup->fetch_array(MYSQLI_ASSOC))
{
//$name = removeslashes($row['name']);
$name = $row['name'];
//$description = removeslashes($row['description']);
$description = $row['description'];
$meta_description = $row['meta_description'];
$meta_keyword = $row['meta_keyword'];
$tag = $row['tag'];
$product_id = $row['product_id'];
$modified_by = $row['modified_by'];
$language_id = $row['language_id'];
if($row['language_id'] == 4)
{
$image = $row['image'];
$ean = $row['ean'];
$name = $row['name'];
$model = $row['model'];
$status = $row['status'];
$price_sync = $row['price_sync'];
$date_modified = $row['date_modified'];
if(!$stmt->execute())
return false;
}
if(!$stmt2->execute())
return false;
$i++;
if(($i % 500) === 0) $mysqli->commit();
}
$mysqli->commit();
$backup->close();
return true;
}
function removeslashes($string)
{
$string=implode("",explode("\\",$string));
return stripslashes(trim($string));
}
오류가
Fatal error: Call to a member function bind_param() on boolean in
어떤 제안입니다 : 위의
$stmt2->bind_param('sssssisi', $name, $description, $meta_description, $meta_keyword, $tag, $modified_by, $product_id, $language_id);
전체 기능은 라인을 포함하여 다음과 같이이다 : 문제의 라인은? 나는 내가 뭘 잘못하고 있는지 보지 못합니다. 모두에게 미리 감사드립니다.
오류 메시지를 붙이세요 !! – Saty
@Saty 나는 그런 바보이다 - 미안하다, 나는 그것을하지 않는다. 오류 : 치명적인 오류 : – Nancy
의 boolean 값에 bind_param() 멤버 함수를 호출하십시오. $ name = $ row [ 'name'];'this ''if ($ row ['language_id '] == 4)' – Saty