添加排序功能时,为什么我的代码中出现未定义的索引错误?这些是我得到的错误
注意:未定义的索引:在 C:\xampp\htdocs\how are things\admin panel\view.php 中排序第 58 行
注意:未定义的索引:在第 61 行的 C:\xampp\htdocs\how are things\admin panel\view.php 中排序
注意:未定义的索引:在第 64 行的 C:\xampp\htdocs\how are things\admin panel\view.php 中排序
注意:未定义的索引:在第 67 行的 C:\xampp\htdocs\how are things\admin panel\view.php 中排序
注意:未定义的索引:在第 70 行的 C:\xampp\htdocs\how are things\admin panel\view.php 中排序
注意:未定义的索引:在第 73 行的 C:\xampp\htdocs\how are things\admin panel\view.php 中排序
注意:未定义的索引:在第 76 行的 C:\xampp\htdocs\how are things\admin panel\view.php 中排序
这是第 58 61 64 67 70 73 76 行的代码
$result = "SELECT * FROM customers";
if($_GET['sort'] == 'first_name'){
$result .= " ORDER BY first_name";
}
else if($_GET['sort'] == 'last_name'){
$result .= " ORDER BY last_name";
}
else if($_GET['sort'] == 'address'){
$result .= " ORDER BY address";
}
else if($_GET['sort'] == 'phone_number'){
$result .= " ORDER BY phone_number";
}
else if($_GET['sort'] == 'email'){
$result .= " ORDER BY email";
}
else if($_GET['sort'] == 'city'){
$result .= " ORDER BY city";
}
else if($_GET['sort'] == 'country'){
$result .= " ORDER BY country";
}
$result = mysql_query($result) or die(mysql_error());