Questions tagged as 'pdo'

3
answers

How to ask the PDO if the insertion was made or gave an error?

How to ask $Produtos if the insertion was made or if there was an error in insertion attempt type or die of mysql ? if(isset($_POST['cadastra_produtos'])){ /////////////////////////////////// $Produtos = $pdo-&...
asked by 16.11.2014 / 00:48
2
answers

What are the Try / Catch blocks?

I would like to know what the try...catch blocks are. I would like more information in Portuguese, because in English I did not understand much, only that it would be a kind of if...else . What are these try...catch bl...
asked by 07.03.2017 / 19:20
3
answers

Is it necessary to use the third bind * parameter?

I would like to know if I should use the third value of bindValue() / bindParam() ? For example: $resultSQL->bindValue(1, $email, PDO::PARAM_STR); Or there's no need for me to use: $resultSQL->bindValue(1, $email);...
asked by 14.03.2017 / 13:53
1
answer

PDO shows no errors

My connection code does not show errors, what is the problem, I searched in several places and did not find anything about it: class Connect { protected static $db; public function __construct() {} public static function Databas...
asked by 31.05.2017 / 16:54
1
answer

PDO with Emulated prepares is insecure? What's the difference?

Recently I did some research on the internet and noticed that several people say that PDO does not protect 100% against injection, specifically with emulated preparations. If possible, someone gives me an example of SQL that would pass the PDO w...
asked by 09.09.2016 / 20:41
1
answer

What are the differences between ADOdb and PDO?

What are the differences between ADOdb and PDO? Which one performs best?     
asked by 29.05.2017 / 18:43
2
answers

Why do I have to assign the value of the prepare method to a variable to only after instantiating the execute? I can not

Ex: $stmt = $db->prepare("SELECT * FROM BD"); $stmt->execute(); Why does not it work if I instantiate the execute method of the same instance? since the value has already been passed to the prepare method? ex: $db->prepare("SELEC...
asked by 03.05.2014 / 16:00
2
answers

I can not configure the sqlsrv drivers in php7 [duplicate]

In the file php.ini all extensions are found, less the ones I need to connect to the SQL Server database. extension=php_sqlsrv_7_ts_x64.dll extension=php_pdo_sqlsrv_7_ts_x64.dll The .dll is in the C:\php7\ext. No...
asked by 04.01.2017 / 19:26
1
answer

Is it a good practice to have the same name with the column name of the bank?

Let's say I have a input text de name="txtnome" , is it a good practice to have a column of the same name as this input in my table? Being that I'm using PDO for CRUD $st =$this->db->prepare("UPDATE $tabela SET yxtnome=:t...
asked by 11.05.2016 / 04:33
2
answers

PDO :: rowCount () returning -1

I have this routine below, which I used without problems with a MySQL database. However, I had to migrate to a SQL Server 2008 database, which was simple. The only problem is that, I do not know why my rowCount() is returning -1...
asked by 08.12.2014 / 18:15