Questions tagged as 'pdo'

1
answer

Problem with login system - array

Hello. I'm creating a login system for study purposes. I have identified in the file that is not populating the array with the information of the database ... and yes, I already made sure that the entered email and password already exists in...
asked by 03.01.2017 / 23:23
1
answer

SQL has no results after using bind

I made this code to create databases : public function addDatabase($name, $collation) { try { $sql = "CREATE DATABASE ':name' COLLATE ':collation';"; // Prepare the query to execute $query = $th...
asked by 04.04.2015 / 15:59
1
answer

I changed mysqli to PDO and I can not get row

In my mysqli it was easy $_SESSION['userphoto'] = $row['userphoto']; How to make PDO work? ConnectionLogin.php session_start(); $stmt->bindParam(':email', $_POST['email']); $stmt->bindParam(':senha', md5($_POST['senha'])); $...
asked by 15.04.2015 / 01:22
1
answer

Connections and management

PHP - PDO, Connections and connection management    The connection remains active for the entire life of the PDO object. To close the connection, you must destroy the object, ensuring that all the references remaining to it are deleted - y...
asked by 30.08.2014 / 07:29
4
answers

How to use Try Catch in an insert

How do I use a try catch to return me an error from an insert that was not inserted into the database. For example $sql = $pdo->prepare("INSERT INTO usuarios (nome,email,senha,telefone) VALUES (:nome,:email,:senha,:telefone)"); $sql->...
asked by 28.06.2018 / 22:14
4
answers

Update the data in the bank without changing the others that already exist - PDO

Hi, I am trying to create a page to change the cadastral data with mysql database, but it should only update the data that is filled and do not change the other data if they already exist in the database. I've tried a thousand ways and I can...
asked by 25.10.2017 / 15:08
1
answer

Add X days to an already predefined date in MySQL

I need to create a deadline, an expiration date for access In case I am using to capture the current time, the "criado" datetime DEFAULT CURRENT_TIMESTAMP, Where I use CURRENT_TIMESTAMP to get the time of writing in MySQL, after the crea...
asked by 13.02.2017 / 19:16
1
answer

MySQL query with PDO does not return data

I have the following problem. I developed a PHP class for a site I'm creating and in one of those functions I'm having a problem with the PDO. When giving the command SELECT I use the rowCount () function to check if it has obtained resul...
asked by 30.12.2016 / 07:31
2
answers

How to split an array and write to the database in PDO

I have this code: <?php foreach ($_POST as $dados =>$value) { $list = explode('_', $value); echo '<pre>' . print_r( $list, TRUE ) . '</pre>'; ?> It generates array output: Array ( [0] => Manoel da S...
asked by 18.05.2016 / 19:53
1
answer

An Exception PDO occurs when localhost is used as host

Consider the following adapter class DbAdapterMySQL that extends the class PDO : class DbAdapterMySQL extends \PDO implements DbInterface { public function __construct(array $config) { $dsn = "mysql:dbname={$confi...
asked by 29.02.2016 / 16:22