=
을 =>
으로 변경했습니다.사용자가 mysql 행을 삭제할 수있게하려고했습니다
Warning: Invalid argument supplied for foreach() in /home/a9083956/public_html/zundappgroesbeek/beheer/testretrievesql.html on line 31
내가 PHP를 오류 메시지가 무엇입니까 : 불행하게도, 난 다른 오류 메시지가 표시됩니다. 내가 도대체 뭘 잘못하고있는 겁니까?
Parse error: syntax error, unexpected '=', expecting ')' in /home/a9083956/public_html/zundappgroesbeek/beheer/testretrievesql.html on line 31
내 HTML은 다음과 같습니다
<html>
<head>
<title>Retrieve data from database </title>
</head>
<body>
<?php
// Connect to database server
mysql_connect("mysql7.000webhost.com", "a9083956_test", "sesam") or die (mysql_error());
// Select database
mysql_select_db("a9083956_test") or die(mysql_error());
// SQL query
$strSQL = "SELECT * FROM forum_question";
// Execute the query (the recordset $rs contains the result)
$rs = mysql_query($strSQL);
// Loop the recordset $rs
// Each row will be made into an array ($row) using mysql_fetch_array
while($row = mysql_fetch_array($rs)) {
// Write the value of the column FirstName (which is now in the array $row)
echo '<input name="delete['.$row['id'].']" type="checkbox">';
echo $row['topic']. " " .$row['name']. " " .$row['datetime'] . "<br />";
}
$delete = $_POST['delete'];
foreach($delete as $id = $value)
{
$id = mysql_real_escape_string($id);
mysql_query("DELETE FROM table_name WHERE id = $id");
}
// Close the database connection
mysql_close();
?>
</body>
</html>
가능한 [양식 삭제 버튼으로 PHP를 사용하여 MySQL 데이터베이스에서 행을 삭제하는 방법] (http://stackoverflow.com/questions/23425147/how-to-deleterows-from-a-mysql- 데이터베이스 사용 - PHP와 - 양식 - 삭제 버튼) – Unihedron