When I try to connect php whith the container that has the mysql server I get this error This is the docker compose file: This is the connection class: Now that I changed the host to 127.0.0.1, the connection is refused. And there’s no way that the MySQL server isn’t running, cause i can connect to it using php-server, but
Tag: pdo
SQLSTATE[42000]: Syntax or access violation: 1064 you have an error in your SQL syntax
hi am trying to run a sql query but it gives this error, i have reservations column in stores table and a reservations table which has firstname,lastname or email: code: Answer remove the “,” and that will solve your problem
PHP PDO output to specific Json Format
I have been trying to get a query output formatted in a specific way but I am surely doing something wrong. Could anyone that knows what I am doing wrong give me a hand? Thanks a lot. I have the following db call: If I run this query in the db (mysql) I get this: When I make a call
Cannot terminate or close a PDO connection MySQL
The page seems to continue loading indefinitely event when the script reaches the end. How can I terminate the connection after breaking out of the PHP loop? I have set the $pdo and $usearch variables to null and reviewed other questions. Answer I moved to MySQLi:
PDO MySQL external connection stale after being inactive for specific amount of seconds
Software versions: After migrating our database to the new server and new software I noticed strange behaviour which could be shown with this simplified code snippet below: This script output is: After this, the process becomes stale and does nothing, PREPARING STATEMENT is the last sentence I see in the output until max execution time is reached – then the
PDOException: SQLSTATE[22007]: 1292 Incorrect datetime value on UTC ISO-8601
Hello I’m getting the following error PDOException: SQLSTATE[22007]: 1292 Incorrect datetime value ‘2022-03-07T18:08:12.000000Z’ for column ‘created_timestamp’ at row 1 in /[path]/[to]/[project]/vendor/laravel/framework.src.Illuminate/Database/Connection.php:496 That looks like a valid UTC ISO-8601 date format to me. And in the following code The var dump prints a carbon instance. The docs say: When a column is cast as a date, you may set the corresponding
Cannot connect to Sphinx with PHP and PDO
I seem to be having issues I do not understand… I have installed MySQL 8.0.27 I have installed Sphinx, created an index, filled it and all is OK through the terminal. Am able to query the Spinx index, without issues. So searchd and the indexer are doing their job. I have created a simple PHP interface to search through this
When does Zend Framework delete entries from the session table?
After we switched our project from PHP5 to PHP7, there were problems during SELECT (deadlocks) and DELETE (timeouts) commands on the session table. We didn’t take a look at it for a long time, but there were more than 20 Million (!) entries since Octoboer 2020. Obviously, the deletion which took too long ruined the select statement. We switched the
PDO : using bound parameters inside a function
I am using PDO to connect to MySQL, and I have an issue as follows : Given that code Then, I want to call a function foo($stmt,…), How can I use the array $params inside that function which would assign new values for each element of the $params array? Answer You will need to pass the $params array to the
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