Jump to content


New Members
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About airartist74

  • Rank
  1. airartist74

    $_GET not working

    Hello, I am working on a cms site but I am having trouble with retrieving some info by id. I followed a tutorial on youtube and my code looks correct but my ID string is empty. Any help would be greatly appreciated. Class with functions class Article { public function fetch_all(){ global $pdo; $query= $pdo->prepare("SELECT * FROM article"); $query->execute(); return $query->fetchAll(); } public function fetch_data($article_id) { global $pdo; $query = $pdo->prepare("SELECT * FROM article WHERE article_id =?"); $query->bindValue(1, $article_id); $query->execute(); return $query->fetch(); } ************************************* Call to functions include_once('includes/connection.php'); include_once('includes/article.php'); $article = new Article; var_dump($_GET, $_POST); //var_dump($article); if (isset($_GET['id'])){ $id = $_GET['id']; $data = $article->fetch_data($id); print_r($data); When I var_dump the get and post I get array(0) { } array(0) { }. fetch all works great but fetch data does not and I am not sure where the post id is pulling from since there isn't a prior connection. Thank You, Devin

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.