Skip to content

Tag: pdo

Undefined class constant ‘PDO::FETCH_DEFAULT’

I’m using PHP FluentPDO, this query works in localhost, but not in webhosting. PHP version is 7.4, FluentPDO: “envms/fluentpdo”: “^2.2”: The error is: Undefined class constant ‘PDO::FETCH_DEFAULT’ Answer PHP version is 7.4 This PHP version is no longer supported. Please upgrade to an actively supported version if you can. PDO::FETCH_DEFAULT is available only since PHP 8.0.7, so if you are

PHP/ADO Registration Submission [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 months ago. Improve this question ( ! ) Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: ” for column ‘cust_b_country’ at row 1 in C:wampwwwecommerce-website-masterregistration.php on line

How can I update json column with a correct data type with PDO?

I have MySQL 5.7 and a query with PDO: But after it I’m having: id data 1 {“old_field”: 2, “new_field”: “1”} Why does my new value have a string type? Expected table: id data 1 {“old_field”: 2, “new_field”: 1} I have success without using PDO(JSON_OBJECT(‘new_field’, 1)), but I have a string type with using placeholders. Answer When you pass an

Assign value PHP variable as column name during fetching

I am trying to fetch the values from columns in a MySQL table using PHP. The variable $batch_id is dynamic, i.e. it changes column name depending on the request. Say, it can adopt value like ‘Batch1’ or ‘Batch10’. I was able to extract the column name into the $batch_id variable, but when I am passing the column name, say ‘Batch10’

PHP A Good way to pass the PDO Object into other Main classes

im new to PHP OOP, now i was woundering if there is a better way to use the Database Class then just extending it over all. For Example i am having 3 main classes: Employee, Customer, Article. each of this classes have a subclasses which extends form. what i have done until now is extand the Db class on each

shopping cart with PHP and connected to the MySQL

Good evening, I am currently working on the implementation of a shopping cart through PHP and MySQL, I am getting the following error at line 172 onwards, I have been looking at the quotes but I cannot find the problem, what could be the solution to this? I have been changing this cart from a mysqli version of it into