我试图理清但说排序是不确定的:未定义指数:排序
注意:未定义指数:排序在C:\ XAMPP \ htdocs中\的index.php上线23
注意:未定义的索引:排序在C:\ XAMPP \ htdocs中\的index.php上线27
说明:未定义指数:排序在C:\ XAMPP \ htdocs中\的index.php上线31
说明:未定义指数:在35行排序C:\ xampp \ htdocs \ index.php
任何人都可以提供帮助吗?
<tbody>
<?php
$sortby = isset($_GET['sort']) ? $_GET['sort'] : 'id';
if ($_GET['sort'] == 'id')
{
$sql .= " ORDER BY id";
}
elseif ($_GET['sort'] == 'nome')
{
$sql .= " ORDER BY nome";
}
elseif ($_GET['sort'] == 'idade')
{
$sql .= " ORDER BY idade";
}
elseif($_GET['sort'] == 'peso')
{
$sql .= " ORDER BY peso";
}
$serverName = "asdaf-DEMO";
$options = array( "UID" => "sa", "PWD" => "fasdasd", "Database" => "demo");
$conn = sqlsrv_connect($serverName, $options);
if($conn) {
$sql="SELECT * FROM cliente";
$aResult=sqlsrv_query($conn, $sql);
while($rows = sqlsrv_fetch_array($aResult))
{
$id = $rows['id'];
$nome = $rows['nome'];
$idade = $rows['idade'];
$peso = $rows['peso'];
?>
[PHP: “注意:未定义变量”, “注意:未定义指数” 和 “通知:未定义偏移”]的可能的复制:(https://stackoverflow.com/后
if/else
条件此外覆盖$sql
问题/ 4261133/php-notice-undefined-variable-notice-undefined-index-and-notice-undef) – schellingerht你上面代码中的哪一行是行号23? –
if($ _GET ['sort'] =='id') –