Есть проблема с моей переменной GET
Всякий раз, когда я нажимаю кнопку Изменить, он показывает эти ошибки ниже
Обратите внимание: неопределенная переменная: _Get in C:\xampp\htdocs\OOP1\blog\admin\edit_post.php на Линии 9
Фатальная ошибка: вызов функции-члена fetch_array() на не-объекте в C:\xampp\htdocs\OOP1\blog\admin\edit_post.php на линии 13
Что я уже пробовал:
<?php include "../libs/config.php"; include "../libs/db.php"; //Creating database object $db = new database(); //getting the id $id = $_Get['id']; $query = "SELECT * FROM posts WHERE id = '$id'"; $posts = $db ->select($query); $single = $posts ->fetch_array(); //Inserting Posts if(isset($_POST['submit'])){ //creating variables for texts $title = $_POST['title']; $content = $_POST['content']; $cat = $_POST['cat']; $author = $_POST['author']; $tags = $_POST['tags']; //creating varibles for image $image = $_FILES['image']['name']; $image_tmp = $_FILES['image']['tmp_image']; move_uploaded_file($image_tmp,"../images/$image"); $query = "INSERT INTO posts (category_id,title,content,author,image,tags) VALUES ('$cat','$title','$content','$auhor','$image','$tags')"; $run = $db->insert($query); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="description" content=""> <meta name="author" content=""> <link rel="icon" href="../../../../favicon.ico"> <title>Admin Panel</title> <!-- Bootstrap core CSS --> <link href="../styles/bootstrap.css" rel="stylesheet"> <!-- Custom styles for this template --> <link href="../styles/custom.css" rel="stylesheet"> </head> <body> <div class="blog-masthead"> <div class="container"> <nav class="nav"> <a class="nav-link active" href="index.php">Dashboard</a> <a class="nav-link" href="add_post.php">Add New Post</a> <a class="nav-link" href="add_category.php">Add New Category</a> <a class="nav-link pull-right" href="../index.php">View Blog</a> <a class="nav-link pull-right" href="logout.php">Logout</a> </nav> </div> </div> <div class="blog-header"> <div class="container"> <h1 class="blog-title"></h1> <p class="lead blog-description"></p> </div> </div> <div class="container"> <div class="row"> <div class="col-sm-12 blog-main"> <br/> <form action="add_post.php" method="post" enctype="multipart/form-data"> <div class="form-group"> <label>Post title:</label> <input type="text" name = "title" class="form-control" placeholder="Enter a title" value="<?php echo $single['title'];?>"/> </div> <div class="form-group"> <label>Post Content:</label> <textarea class="form-control" rows="3" name="content" placeholder = "Enter a content"></textarea> </div> <select name="cat" class="form-control"> <option>Select a Category</option> <?php while ($row1 = $cats->fetch_array()) :?> <option value="<?php echo $row['id'];?>"><?php echo $row1['title'];?></option> <?php endwhile ;?> </select> <div class="form-group"> <label>Author Name:</label> <input type="text" name="author" class="form-control" placeholder="Enter author name"> </div> <div class="form-group"> <label>Post Image:</label> <input type="file" name="image"> </div> <div class="form-group"> <label>Tags:</label> <input type="text" name="tags" class="form-control" placeholder="Enter text"> </div> <button type="submit" name="submit" class="btn btn-success">Submit</button> <a href="index.php" class="btn btn-danger">Cancel</a> </form> </div><!-- /.blog-main --> <?php include "includes/footer.php"; ?>