0
在我的本地服務器中,此腳本正常工作。當我上傳這個腳本時,它不能正常工作。foreach數據庫中沒有更新數據
它只將126行數據插入到數據庫中,但我需要一次上傳至少500行。
<?php
include 'database-config.php';
foreach($_POST['classroll'] as $row=>$classroll)
{
$sclassroll = $classroll;
$mark = $_POST['mark'][$row];
$type = $_POST['rtype'];
$session = $_POST['rsession'];
$department = $_POST['rdepartment'];
$examtype = $_POST['rextype'];
$examyear = $_POST['rexyear'];
$examsubject = $_POST['rexmarksubject'];
$stmt = $dbh->prepare("INSERT INTO exammarks(studnettype, studentsession, studentdepartment, studentclassroll, examtype, examyear, examsubjec, exammarks) VALUES (:studnettype, :studentsession, :studentdepartment, :studentclassroll, :examtype, :examyear, :examsubjec, :exammarks)");
$stmt->bindParam('studnettype', $type);
$stmt->bindParam('studentsession', $session);
$stmt->bindParam('studentdepartment', $department);
$stmt->bindParam('studentclassroll', $sclassroll);
$stmt->bindParam('examtype', $examtype);
$stmt->bindParam('examyear', $examyear);
$stmt->bindParam('examsubjec', $examsubject);
$stmt->bindParam('exammarks', $mark);
$stmt->execute();
}
header('Location: ../home.php');
?>
有沒有一種可能性,即有第126位插入後MySQL錯誤? – SheppardDigital
您可以檢查本地服務器上的最大執行時間和腳本超時是否與您的活動服務器的超時時間相同? –
你需要增加最大執行時間寫'ini_set('max_execution_time',300); ''在頁面頂部 – Saty