Questions tagged as 'pdo'

1
answer

Unexpected error in PDO class

I've been breaking the code with this code for some time, it's the first time I'm using the PHP PDO class and I'm having an error that I do not know how to solve. <?php include "conexao.php"; $banco = new Banco(); //Instanciando o banco de...
asked by 22.10.2016 / 16:18
2
answers

PHP error with SQLserver exception 'PDOException' with message 'SQLSTATE [08001]: [Microsoft] [ODBC Driver 11 for SQL Server]

I installed the driver right in PHP, I added the extension in php.ini , but when I try to connect with PDO in sqlserver, this error appears:    exception 'PDOException' with message 'SQLSTATE [08001]:   [Microsoft] [ODBC Driver 11 for S...
asked by 14.09.2016 / 21:48
1
answer

Connection Php MySQL PDO in localhost by ip

I have a PHP / MySQL system in which I connect via PDO on the localhost host, but I will need to put the IP of the server "xxx.xxx.xxx.xxx" instead of "localhost", the system works but very slow . I do not know what it can be, both Apache and My...
asked by 10.06.2016 / 22:58
1
answer

How to fix the "1452 foreign key constraint fails" error using PDO in PHP?

Firstly I know what the foreign key error is, however I do not know why it is happening in PHP code with the PDO.    Insertion Function: function insert_pedido($cod,$pagamento,$total){ (int)$id = $cod; $con = $this->connect(...
asked by 02.03.2016 / 19:51
1
answer

php function filter pdo

I have a php function that returns me in a table all html NrPlaca but I would need a filter in the php function to show in the table only the DsTpVeiculo > are bitruck, I would like some tips on how to do it. Next image of the database:...
asked by 07.01.2016 / 12:47
1
answer

How do I select multiple values from the same table

How do I select values 1, 2, 3, 4, and 5 from the same table without doing that SELECT bundle? <?php $rateone = 1; $ratetwo = 2; $ratethree = 3; $ratefour = 4; $ratefive = 5; $query = "SELECT COUNT(rate) as rate FROM tb_comment...
asked by 15.12.2015 / 04:59
1
answer

PDO does not return count

I need to store the result count, but apparently with the PDO I can not store the value. I have already circled the select out and come the result, why can not I store the result $flag in the variable? $query = "SELECT COUNT(...
asked by 14.12.2015 / 16:30
1
answer

Correct way to send values through PDO [duplicate]

I was informed that I was doing incorrectly, the sentence said was as follows: "It's no use to use a newer API and maintain the old vices of mysql_* , you should not pass the values directly in the SQL statement, pass them apart using...
asked by 18.12.2015 / 13:25
2
answers

How to verify in the database if the cadastre has already been made PDO

How do I check if id of the user no longer has a record in the database and continue with insert ? if(isset($_POST['submit'])){ $comment = trim(strip_tags($_POST['comment'])); $insert = "INSERT into tb_comment (id_mark,...
asked by 10.12.2015 / 22:46
1
answer

Doubt over PDO connection

And to folks, I have a question about the PDO connection. This is the connection I have in the script I'm configuring: <?php function getDB() { $dbHost = 'host'; $db = 'bd'; $dbUser = 'user'; # Get database password...
asked by 26.10.2015 / 16:08