我試圖理清但說排序是不確定的:未定義指數:排序
注意:未定義指數:排序在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') –