Skip to main content

All Questions

Tagged with
0 votes
2 answers
2k views

PHP PDO dynamic update query to MYSQL

I have a form with an image upload and text inputs. it keeps replacing the profile_picture field with NULL. Therefore, I'm trying to create a dynamic update query, where if one value is empty it's ...
0 votes
2 answers
45 views

Need to Fetch the data in PDO::FETCH_CLASS in PHP

I am facing a little problem, I have a User class that connects to the database using a static::method and fetching all users using my custom method find_all(), the result is gonna be returned ...
1 vote
1 answer
15k views

Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation

I don't know why am I gettng the error Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that ...
3 votes
2 answers
12k views

enable pdo_sqlsrv in php 7.2, not working

I have followed all the guided path, download the appropriate sql driver for php 7.2 from https://github.com/Microsoft/msphpsql/releases copy and past the ts files to my xampp/php/ext folder, enabled ...
0 votes
2 answers
8k views

How to install PDO Sqlite on windows?

Does anyone know how can I install PDO SQLite extension on Windows? I have PHP 5.3 compiled with the following config: Configure Command => cscript /nologo configure.js "--enable-snapshot-build" ...
1 vote
2 answers
392 views

PDO update - keep original values

I have following UPDATE statement: "UPDATE table SET value=:value, symbol=:symbol WHERE id=:id"; value is always set, but symbol doesn't have to be (meaning, that if user doesn't update symbol, it ...
12 votes
5 answers
31k views

Install / Configure SQL Server PDO driver for PHP docker image

I have a simple docker file, as follows: FROM php:7.2-apache COPY src/ /var/www/html/ Normally to install drivers for Mongo or MySQL connectivity I would do so by adding something like the below to ...
0 votes
1 answer
50 views

Protection query against SQL injection, using PDO [duplicate]

may I ask you how to make this protected against sql injection? I have $podminkazeme = ""; $podminkakraj = ""; if ( isset( $_GET[ "zeme" ] )and !empty( $_GET[ "zeme&...
126 votes
11 answers
105k views

MySQL check if a table exists without throwing an exception

What is the best way to check if a table exists in MySQL (preferably via PDO in PHP) without throwing an exception. I do not feel like parsing the results of "SHOW TABLES LIKE" et cetera. There must ...
0 votes
1 answer
80 views

OSX Sonoma fresh brew of mariadb, php unable to load pdo-mysql

We are tearing our hair out! We brewed mariadb and php but continue to get errors when running php. Just a command like: php -v Error like this: PHP Warning: PHP Startup: Unable to load dynamic ...
1 vote
1 answer
159 views

PDO rowCount() Supported Databases

I'm just looking for a list of supported databases with the rowCount() method from PDO. I know this sounds like a RFTM question, but I honestly cannot find anything at all relating to which specific ...
36 votes
7 answers
139k views

Connect to SQL Server through PDO using SQL Server Driver

I am trying to connect to an existing SQL Server database using PDO with the drivers provided by Microsoft. I have seen examples using odbc, dblib, mssql, etc., however I believe the connection ...
0 votes
1 answer
25 views

Connection Variable to use while joining separate Databases?

If i have two connection variables while using PDOs, Say, $conUser1 and $conUser2, for separate databases DB1 and DB2. And if I want to execute a query that joins tables from both databases, which ...
0 votes
2 answers
108 views

$this when not in object context when using database class in another class

I have looked at the other questions to this and most say it's to do with calling static methods, etc. and none of which were able to explain why I'm getting this error? I'm getting used to classes ...
0 votes
0 answers
32 views

Reload page with no querystring if original querystring yielded no results from a database query

I've the following code for filename usa.php $query = "SELECT * FROM usa WHERE deleted='0' AND filename<>''"; $stmt = $conn->prepare($query); $stmt->execute(array()); $...

15 30 50 per page