Skip to main content

All Questions

Tagged with
0 votes
1 answer
54 views

Not able to show a pdf / image from binary data in MSSQL using PDO LOB

I go MSSQL database which contains attachments - most of them are PDFs. I want to create simple website, that will display attachment after clicking a button. I got main website prepared (there are ...
0 votes
1 answer
45 views

Transform a multidimensional array from PDO to two simple arrays for a chart [duplicate]

I have a MariaDB with articles and each article has a date. I want to display a bar chart with number of articles per date. I get the data with this code: $statement = $pdo->prepare( " SELECT ...
-2 votes
2 answers
92 views

Create json-encoded array from a PDO query result column

I am creating a json array with data from mysql: $array = $db->query("SELECT ...")->fetchAll(PDO::FETCH_ASSOC); print json_encode($array); This returns: [{"animal":"...
-3 votes
1 answer
35 views

PHP XAMPP Config [closed]

I try to connect my php website with a XAMPP Server so I can access my MySQL database. Any Ideas how the config has to look like, because I'm rather stuck with this one. I tried to make a config but ...
0 votes
2 answers
34 views

MYSQL PDO lat lon searching with multiple in clause

I cannot rack my brain around how to construct this sql query. I have 3 tables. Users table user_id name picture etc tag_ref table user_id tag_id geolocation table user_id geolat geolon What ...
79 votes
11 answers
599k views

PHP Connection failed: SQLSTATE[HY000] [2002] Connection refused

I am trying to use a PHP connection to connect MySQL Database which is on phpmyadmin. Nothing fancy about the connection just trying to see whether the connection is successful or not. I am using MAMP ...
-1 votes
0 answers
31 views

Fatal error: Uncaught PDOException: could not find driver for SQLite [duplicate]

I just created a SQLite database 'data.db'. I want to connect it in this php code: <?php $pdo=new PDO('sqlite:./data.db'); $query=$pdo->query('SELECT * FROM posts'); if ($query === false){ ...
0 votes
0 answers
33 views

Informix PDO assoc_id error SQLSTATE=HY000, SQLDriverConnect: -25546

It has been about half a year that we have been facing an error on our production server. At the beginning it happened every 2-3 months, but last Friday it happened again and today once again. We have ...
0 votes
0 answers
18 views

SQLSTATE[HY000] [2002] No connection could be made because the target machine was selected [duplicate]

I'm trying to connect my windows machine with xampp, using php with PDO, to a server on the local network (Linux) <?php $dbname = "DBNAME"; $user = "USERNAME"; $pass = "...
3 votes
2 answers
12k views

pdo, insert php object to database

I can't find an answer to this question. I want to save a PHP object into a MySQL database. Example: class user{ private $id, $email, $pw, $first, $last, $group,.....; // getters and setters }...
120 votes
4 answers
18k views

Can I mix MySQL APIs in PHP?

I have searched the net and so far what I have seen is that you can use mysql_ and mysqli_ together meaning: <?php $con=mysqli_connect("localhost", "root" ,"" ,"mysql"); if( mysqli_connect_errno( ...
1 vote
1 answer
64 views

PHP is not reading .env file

I am using PHP with PDO to connect to my database. I want to start using environment variables, so I used the following terminal command: composer require vlucas/phpdotenv My .env file now contains ...
0 votes
0 answers
18 views

SQLSTATE[HY093]: Invalid parameter number, fetch data from API [duplicate]

i faced this error when i build API, i want to fetch data that can filter based on 2 category (cpNumber or partNumber). this is result from postman, status code 500 {"error":"Database ...
9 votes
2 answers
18k views

connecting to cassandra from PHP [closed]

I have found lots of questions on here and other sites about what php libraries to use for connecting to cassandra but most of the questions are 1 or more years old. I have also found lots of ...
34 votes
3 answers
98k views

PHP PDOException: "SQLSTATE[HY093]: Invalid parameter number"

I'm getting the error "SQLSTATE[HY093]: Invalid parameter number" when I try to run the below function: function add_persist($db, $user_id) { $hash = md5("per11".$user_id."sist11".time()); $...

15 30 50 per page