Skip to content
Advertisement

Tag: pdo

creating a quiz with php and pdo

I’ve created a quiz for my website, the admin can sign in and change the questions or add questions etc. For the quiz page I’m taking the information down like so: try { $stmt = $db->query(‘…

PHP & PDO: Fastest way to fetch data from

I have an HTML table which is fetched with thousands of rows of messages and the date these were sent by an user and I’m currently trying to understand how to fetch the data faster, as it takes 5 to 9 …

Can’t connect to MySQL with PDO

I’m following this tutorial, I’m currently around minute 04:00 and I want to make a connection with my MySQL database through PDO. But my webpage will always give “Could not connect.” when I’m trying …

PDO changes query

I want to have result of my query as it was before I replaced db connection using PDO. How can I get the query as i t was before I implemented PDO? This is my query: $query = “SELECT `…

How to use PDO::FETCH_CLASS with __set() method?

I want to create an object right after fetching data from my database. For that I’m using PDO::FETCH_CLASS and a rewritten __set() method that I’ve put in a trait. However, I can’t figure out why I have an error mentionning : “Fatal error: Uncaught ArgumentCountError: Too few arguments to function Banner::__construct(), 0 passed and exactly 1 expected in D:Logicielswamp64wwwprojet-4writer-blogentityBanner.php on

PHP PDO to create an object of a class with fetchObject

I am trying to create a “User” object inside my class “User” based on the properties I have stored inside my database, which I use PDO to connect to. I’ve search some pages on Google and found that most people use the fetchObject method for that. Right now, I am trying to use this to create an object of this

Advertisement