0
我正在創建一個腳本,它將查詢舊數據庫並從中提取信息,然後將其推送到新數據庫(使用新結構)。MYSQL無法插入到mediumtext列
我的問題是我舊數據庫中的一個表有一列text
類型。當我拉這個文本(工作),並試圖推送到新的數據庫(具有類型爲mediumtext
的列)查詢不成功。
顯然有一些查詢錯誤,但由於某種原因,我的網頁不輸出任何錯誤。
這個問題更多關於我在做什麼錯誤與我如何輸出我的錯誤到頁面,但不管,任何人都可以幫我嗎?謝謝!
PHP:
$grad5app = mysqli_query($grad5app_connect, "SELECT * FROM international");
while ($row = mysqli_fetch_array($grad5app)) {
$applicationId = $row[0];
$toefl_hasTaken = $row[27];
$toefl_hasReported = $row[28];
$toefl_date = $row[2];
$toefl_score = $row[3];
$hasUSCareer = $row[4];
$usCareerDetails = $row[5];
$hasFurtherStudies = $row[29];
$furtherStudiesDetails = $row[6];
$hasHomeCareer = $row[30];
$homeCareerDetails = $row[7];
$financeDetails = $row[8];
$usFriendsOrRelatives = $row[9];
$usEmergencyContact_name = $row[10];
$usEmergencyContact_relationship = $row[17];
//$usEmergencyContact_contactInformationId = $row[];
$homeEmergencyContact_name = $row[18];
$homeEmergencyContact_relationship = $row[26];
//$homeEmergencyContact_contactInformationId = $row[];
echo $usCareerDetails;
$grad5app1 = mysqli_query($grad5app_connect, "SELECT * FROM applicants WHERE applicant_id = ".$applicationId." ");
while ($row1 = mysqli_fetch_array($grad5app1)) {
$isInternationalStudent = $row1[132];
mysqli_query($gradschool_application_2_connect, "INSERT INTO APPLICATION_International (applicationId, isInternationalStudent, toefl_hasTaken, toefl_hasReported, toefl_date, toefl_score, hasUSCareer, usCareerDetails".
") VALUES (".$applicationId.", ".$isInternationalStudent.", ".$toefl_hasTaken.", ".$toefl_hasReported.", '".$toefl_date."', ".$toefl_score.", ".$hasUSCareer.", '".$usCareerDetails."')");
}
}
可變$usCareerDetails
是什麼是text
類型的,並且需要採取什麼推到類型mediumtext
的列。但是,如果我從查詢中刪除usCareerDetails
,則此查詢不起作用,那麼它會成功推送數據。
輸出頁面:
I'm gonna work in the USA for 2 years.
輸出是從舊數據庫中抽取的echo $usCareerDetails;
。