你们能帮帮我吗?我仍然不明白警告以及如何解决,尽管我查看了所有解决方案
<php
$hostname = "localhost";
$database= "doctor";
$username = "root";
$password = "";
$doktor = mysql_pconnect($hostname, $username, $password) or
trigger_error(mysql_error(),E_USER_ERROR);
$IdCountry = isset($_POST['IdCountry']);
$Country= isset($_POST['Country']);
$result = mysql_query("SELECT * FROM warganegara WHERE IdWarga = '$IdWarga'");
if(mysql_num_rows($result) >0){
while ($test = mysql_fetch_array($result) or die (mysql_error())){
}
if (!$result)
{
die("Error: Data not found..");
}
$Country=$test['Country'] ;
if(isset($_POST['save']))
{
$Country_save = $_POST['ctry'];
mysql_query("UPDATE country SET Country='$Country_save' WHERE IdCountry = '$IdCountry'")
or die(mysql_error());
echo "Saved!";
header("Location: index.php");
}
mysql_close($doctor);
?>
这个问题已经回答了n谢谢大家。但是现在我可以编辑任何内容,因为尽管我单击了某个国家/地区的编辑,但文本字段没有任何内容
isset返回布尔值,因此您的IdCountry等被设置为布尔值而不是字符串。不要对结果进行骰子测试,而是对查询进行骰子测试,您应该没问题。