Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带有pdo数据库连接的未识别PHP变量_Php_Mysql_Pdo - Fatal编程技术网

带有pdo数据库连接的未识别PHP变量

带有pdo数据库连接的未识别PHP变量,php,mysql,pdo,Php,Mysql,Pdo,我得到以下错误: 注意:第29行C:\xampp\htdocs\Projekt\Controller\Controller.php中的未定义变量:WohFK 当我试图将变量交给控制器时 Select.php: <html> <head> <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> // JQuery Reference &l

我得到以下错误:

注意:第29行C:\xampp\htdocs\Projekt\Controller\Controller.php中的未定义变量:WohFK

当我试图将变量交给控制器时

Select.php:

<html>
<head>
    <script
        src="https://code.jquery.com/jquery-1.11.1.min.js"></script> // JQuery Reference
    <script
        src="https://cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js"></script>
    <script
        src="https://cdn.datatables.net/plug-ins/9dcbecd42ad/integration/jqueryui/dataTables.jqueryui.js">
    </script>
    <link rel="stylesheet"
          href="https://code.jquery.com/ui/1.10.3/themes/sunny/jquery-ui.css">
    <link rel="stylesheet"
          href="https://cdn.datatables.net/plug-ins/9dcbecd42ad/integration/jqueryui/dataTables.jqueryui.css">
</head>
<body>
<table id="example">
    <thead>
    <th>Geschlecht</th><th>Vorname</th><th>Nachname</th><th>Alter</th><th>Strasse</th><th>Hausnummer</th><th>Postleitzahl</th><th>Wohnort</th><th>Telefonnummer</th><th>Email</th><th>Webseite</th><th>Wohn</th><th>KontaktFK</th><th>Anpassungen</th>
    </thead>
    <tbody>
    <?php
    $controller = new Controller();
    foreach($entries as $entry){
        echo '<tr><td>'.$entry['Geschlecht'].'</td><td>'.$entry['Vorname'].'</td><td>'.$entry['Nachname'].'</td><td>'.$entry['Alter'].'</td><td>'.$entry['Strasse'].'</td><td>'.$entry['Hausnummer'].'</td>
                <td>'.$entry['PLZ'].'</td><td>'.$entry['Ortsname'].'</td><td>'.$entry['Telefonnummer'].'</td><td>'.$entry['Email'].'</td><td>'.$entry['Webseite'].'</td><td class = "hidden">'.$entry['WohnortFK'].'</td><td>'.$entry['KontaktFK'].'</td>
                <td><a href="?c=Controller&a=Delete&WohFK='.$controller->Delete($entry['WohnortFK']).'">Delete</a></td>
                </tr>';

    }
    ?>
    </tbody>
</table>

<script>
    $(function(){
        $("#example").dataTable();
    })
</script>
</body>
</html>
Navigation.php:

if(isset($_GET['c'])){
    if(include 'controller/' . strtolower($_GET['c']) . '.php'){
                $controller = new $_GET['c']();
                if(isset($_GET['a']) &&
                                method_exists($controller, $_GET['a'])){
                        $controller->$_GET['a']();                          
                                }
    }else{
            echo 'Seite nicht gefunden';
    }

在您提供的代码中,您不会在任何地方调用Controller::Delete()。再看第29行,这里我称之为控制器:与此相关的类在哪里?如果没有类声明,则无法使用public Myru:Ok。这是放置在锚定标记的
href
属性中的文本。其中是将其转换为对Delete方法的调用的代码。它看起来不像是这个世界上的任何地方code@Fred刚刚在您提供的代码中添加了完整的Controller.php和Select.phpYou dont call Controller::Delete()。再看第29行,这里我称之为控制器:与此相关的类在哪里?如果没有类声明,则无法使用public Myru:Ok。这是放置在锚定标记的
href
属性中的文本。其中是将其转换为对Delete方法的调用的代码。它看起来不像是这个世界上的任何地方code@Fred刚刚添加了完整的Controller.php和Select.php
if(isset($_GET['c'])){
    if(include 'controller/' . strtolower($_GET['c']) . '.php'){
                $controller = new $_GET['c']();
                if(isset($_GET['a']) &&
                                method_exists($controller, $_GET['a'])){
                        $controller->$_GET['a']();                          
                                }
    }else{
            echo 'Seite nicht gefunden';
    }