note 130228 added to reserved.variables.get

From: Date: Mon, 07 Apr 2025 15:50:57 +0000
Subject: note 130228 added to reserved.variables.get
Groups: php.notes 
Request: Send a blank email to php-notes+get-222066@lists.php.net to get a copy of this message
<? include 'PostModel.php'; class PostsRepository{ private $pdo; public function __construct($pdo){ $this->pdo = $pdo; } public function fetchPost($id){ $stmt = $this->pdo->prepare("SELECT * FROM posts where id = :id"); $stmt->bindParam(":id", $id); $stmt->execute(); $result = $stmt->fetch(PDO::FETCH_ASSOC); $model = new PostModel($result[0], $result[1], $result[2]); return $model; } public function fetchPosts() { $stmt=$this->pdo->prepare("SELECT * FROM posts"); $stmt->execute(); $results = $stmt->fetchAll(PDO::FETCH_ASSOC); $models = array(); foreach($results as $result){ array_push($models, new PostModel($result['id'], $result['title'], $result['content'])); } return $models; } } ?> ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 194.166.92.154) ---- Manual Page -- https://php.net/manual/en/reserved.variables.get.php Edit -- https://main.php.net/note/edit/130228 Del: integrated -- https://main.php.net/note/delete/130228/integrated Del: useless -- https://main.php.net/note/delete/130228/useless Del: bad code -- https://main.php.net/note/delete/130228/bad+code Del: spam -- https://main.php.net/note/delete/130228/spam Del: non-english -- https://main.php.net/note/delete/130228/non-english Del: in docs -- https://main.php.net/note/delete/130228/in+docs Del: other reasons-- https://main.php.net/note/delete/130228 Reject -- https://main.php.net/note/reject/130228 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#222066) next »