0
當我點擊提交按鈕時,除了將字符串的名稱放在數組中之外,所有的工作都可以使用,我在每行的列名下面的行中獲得名稱「數組」。我一直在改變代碼,並且無法弄清楚。注意我的數組裏面有130多個字符串。數據庫:插入行多查詢
您可以在表中放入無限量的行,對吧? 關於如何解決名稱問題並增加「限制0,30」的建議?
這裏是我的代碼:
是:
$array = ("","","");
$random = $array;
shuffle($random);
現在:
$array = ("","","");
而且仍然無法正常工作。我也試過用mysqli_stmt_send_long_data試驗也無法使它工作。
<?php
include ('login-home.php');
$mysqli = new mysqli("", "", "", "");
if ($mysqli->connect_error) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_error . ") " . $mysqli->connect_error;
}
if (!$mysqli->query("INSERT INTO table(id, name) VALUES (id, '".$array."')")) {
echo "Multi-INSERT failed: (" . $mysqli->error . ") " . $mysqli->error;
}
/* Prepared statement, stage 2: bind and execute */
$id = 1;
if (!$stmt->bind_param("s", $id)) {
echo "Binding parameters failed: (" . $stmt->error . ") " . $stmt->error;
}
if (!$stmt->execute()) {
echo "Execute failed: (" . $stmt->error . ") " . $stmt->error;
}
for ($id; $id = $id+1; $id++) {
if (!$stmt->execute()) {
echo "Execute failed: (" . $stmt->error . ") " . $stmt->error;
}
}
$stmt->close();
?>
感謝帶病上班的,它會需要一段時間,但試圖在一個和它的工作謝謝 – vince