由於地理或Internet提供商問題,某些用戶在使用我們的系統時無法連接WiFi。當某些用戶保存一些產品信息時,我發現一些數據(字段)不是100%保存到數據庫中。這對我來說很難再現問題,因爲我的聯繫很好。防止由於WiFi連接不良而導致數據庫損壞
所以我的問題是如何讓服務器知道我已經發送所有字段進行處理之前保存/更新查詢執行?
case "save":
for ($i=0, $n=sizeof($languages); $i<$n; $i++)
{
$language_id = $languages[$i]['id'];
$name = preg_replace('/\s+/', ' ', tep_db_prepare_input($_POST["products_name"][$language_id]));
$description = tep_db_prepare_input(str_replace(" ", " ", $_POST["products_description"][$language_id]));
$extra_info = tep_db_prepare_input(str_replace(" ", " ", $_POST["products_extra_info"][$language_id]));
tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', 'products_id = "' . $pID . '" AND language_id="'.$language_id.'"');
// update other language that empty
$sql_data_array = array('products_name' => $name);
tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', 'products_id = "'.$pID.'" and products_name = ""');
$sql_data_array = array('products_description' => $description);
tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', 'products_id = "'.$pID.'" and products_description = ""');
$sql_data_array = array('products_extra_info' => $extra_info);
tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', 'products_id = "'.$pID.'" and products_extra_info = ""');
}
... etc
使用數據庫__transactions__ –