得到通知未定义的索引

时间:2015-12-10 23:53:29

标签: php notice

我已阅读以下PHP: "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset"但是我没有在我的案例中找出问题。

我收到通知:下面是未定义的索引,据我所知,我已经定义了infoID:

  

注意:未定义的索引:infoID in   第193行的C:\ xampp \ htdocs \ WebDevelopment \ Bathrooms \ functions.php

function info_byidx($sql) {
            include 'connect.php';
    $id = $_GET['infoID'];
    $select = $conn->prepare($sql);
    $select->bind_param('s', $id);
    $select->execute();
    $select->store_result();
    if ($select->num_rows > 0) {
        $meta = $select->result_metadata();
        while ($field = $meta->fetch_field()) {
            $params[] = &$row[$field->name];
        }
        call_user_func_array(array($select, 'bind_result'), $params);
        while ($select->fetch()) {
            if ($row['title'] == "NULL") {
                echo "<h3>".$row['subtitle']."</h3>\n<p>".$row['content']."</p>\n";
            }
            else if ($row['subtitle'] == "NULL") {
                echo "<h2>".$row['title']."</h2>\n<p>".$row['content']."</p>\n";
            }
            else {
            echo "<h2>".$row['title']."</h2>\n<h3>".$row['subtitle']."</h3>\n<p>".$row['content']."</p>\n";
            }

        }
        $select->close();
    }

}

infoID定义为:

  

http://localhost:1234/WebDevelopment/Bathrooms/info.php?pageID=2?infoID=x - generalID

的值在哪里

1 个答案:

答案 0 :(得分:0)

http://localhost:1234/WebDevelopment/Bathrooms/info.php?pageID=2?infoID=x

将其修复为

http://localhost:1234/WebDevelopment/Bathrooms/info.php?pageID=2&infoID=x
只有一个?首先,然后使用&amp;分开下一个key = values。