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(‘…
Tag: pdo
PostgreSQL integer field is returned as string in PHP
I’m using PHP 7.2.12 and PostgreSQL 9.5.5 and Lumen 7 when i execute a query with query builder, Lumen give me numeric column as string. Table: id: bigint { id: “1” } i have searched for and …
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 …
Problem with binding NULL value to named placeholders with associative array in execute function in PDO
I am trying to construct and execute a delete query when the table_name and the conditional_clauses are passed as parameters in OOP fashion. I am using PDO by wrapping it in a custom wrapper. I am …
SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens – help needed
I’ve tried making a website which has a database connected to it and I’m getting the error message below INSERT INTO Diák (oktatási_id, vezeték_név, kereszt_név, évfolyam, születési_dátum, város,…
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 enable php pdo driver for Postgres on Ubuntu 18.04
I installed php 7.2 and php 7.3 on Ubuntu 18.04, and created a php file to log on to and insert data into the Postgres database. My script responded “could not find driver.” Research turned up …
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