Questions tagged as 'pdo'

1
answer

Connection in separate databases PDO - (multi-tenancy)

I have the following example for my application: I have a PHP + MySql application, with PDO connection, I need the application to be shared with all registered companies, however each company will have its database separately. APPLICATION ST...
asked by 28.06.2018 / 03:40
2
answers

SQLSTATE [23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'

When I try to INSERT my table with PDO, I get the following error: SQLSTATE [23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' I've done a lot of research and saw some similar problems, but all for lack of AUT...
asked by 21.11.2016 / 17:00
1
answer

What extension of PHP should I use with SQL Server 2000?

I am trying to connect to the SQL Server 2000 database using PHP PDO SQLSRV, but when access to index returns me the catch() with the following error    SQLSTATE [08001]: [Microsoft] [SQL Server Native Client 11.0] SQL Server Native...
asked by 16.02.2016 / 00:32
2
answers

Connection with PDO does not give error, nor with dummy bank

I'm starting with PDO. I'm trying to connect to the bank and I can not. I have the following code $host = "localhost"; $user = "root"; $pass = "root"; $dbname = "angularDB"; try { $pdo = new PDO("mysql:host=loca...
asked by 02.10.2015 / 22:34
1
answer

How to sort and filter queries between two tables?

I have two tables, one of posts and one of friends. In my script there is a feed area where I would like to display the latest posts from the logged-in user's friends. But instead of bringing the last posts in order, the result sorts the...
asked by 13.02.2015 / 05:56
1
answer

How to connect to SQLite database that already exists using PDO?

I want to connect to a database that already exists using PDO and sqlite in PHP, and here is the code I have: class Database extends PDO{ public function __construct(){ parent::__construct("sqlite: userquestion.db"); $th...
asked by 16.03.2015 / 02:42
1
answer

PDO Insert multiple row in same insert using bindParam

I have a default function that I use for all my inserts (when they only have 1 insert at a time), which would be: insereRegistro($sql, $param=NULL) { $query = $conn->prepare($sql); //Converte os parâmetros para bindParam if ( i...
asked by 06.01.2017 / 13:18
1
answer

PDO with type BIT

I was now doing a statement with on duplicate and I have some fields like BIT . My DB class does typing using PDO::PARAM_STR , PDO::PARAM_BOOL , PDO::PARAM_INT ... but the use of these constants is optional, and when...
asked by 18.08.2015 / 04:10
1
answer

How to convert latin1_swedish_ci data to utf8_bin in php?

I've got a SQL script that "mounts" 3 tables, one with country, one with states, and one with Brazilian cities. The script makes the collection , of the names, in latin1_swedish_ci and I needed it to be utf8_bin , because the...
asked by 13.01.2016 / 15:01
1
answer

Difficulty updating data with angular and php

Good afternoon I'm trying to update data in the database and I can not. If I use mysqli, the following warning appears on the console: " link 500 (Internal Server Error)" If I use connection with mysql and PDO, nothing happens, no warning...
asked by 09.01.2016 / 18:44