Questions tagged as 'pdo'

1
answer

Using LastInsertId () more than once

I need to use lastInsertId () more than once in my application. Here is an example of such an event: <?php //CONEXÃO COM O BANCO DE DADOS $pdo=new PDO("mysql:host=localhost;dbname=xxx","xxx","xxx"); //VARIÁVEIS COM DADOS DO FORMULÁRIO $nom...
asked by 20.05.2017 / 03:23
1
answer

I can not use a query method when I use a connection class

My connection class: class Connection{ private $host="localhost"; private $user="root"; private $password=""; private $dbname="test"; private function conectionDB(){ $conn = new PDO("mysql:host=$this->...
asked by 27.05.2017 / 19:27
1
answer

Page does not load because of transaction

I'm trying to implement a transaction in my SQLs, but because of them, my page does not load. Here is the code: <?php //CONEXÃO COM O BANCO DE DADOS include_once("conexao.php"); //VARIÁVEIS COM DADOS DO FORMULÁRIO $nome = $_POST["nome"]; $...
asked by 17.05.2017 / 21:02
0
answers

SQLSTATE [23000]: Integrity constraint violation

I have an employee table and address. The address is a foreign key of the employee, however, is giving the following error when I insert: Exception 'PDOException' with message 'SQLSTATE [23000]: Integrity constraint violation: 1452 Can not ad...
asked by 16.05.2017 / 21:32
1
answer

Inserting data with PHP using classes and PDO

Good evening everyone. I have the task of creating a complete CRUD on the site where I work. However I need to use classes and methods with PHP. See what happens. I have class usuario.class , where I put all attributes and methods Ge...
asked by 02.06.2017 / 03:11
0
answers

Double Precision Firebird on PDO

Good afternoon, I'm doing a query in a firebird table using PDO PHP, and in a specific field this table is returning all equal values in all records, this field is of type Double Precision. Is it some PDO bug? Has anyone ever experienced this ?...
asked by 12.05.2017 / 19:24
0
answers

Question: Connection and consultation with PHP, PDO and MYSQL

Good afternoon! I have an error that I can not identify at all. I need to perform more than one query in different classes on one screen. My problem is happening when the second query is executed Php is returning, Call to member function prepar...
asked by 03.05.2017 / 19:29
1
answer

Delete BD and Folder image

I am trying to create a script that deletes the image from the database and the folder, but the problem is that it is only deleting from the DB and not from the folder. Tabela equipes id, nome, foto Here is the PHP I'm using: $id = $_GET...
asked by 12.05.2017 / 14:40
2
answers

Verify that the user is active in the database

I need to make a query if the user is active. Ex. My client logs in to the panel, if my status is disabled, it shows me a message, if my status is active on the page. follow my code <?php // inclui o arquivo de inicialização...
asked by 27.04.2017 / 21:20
1
answer

Problems with PHP function - PDO [closed]

Fatal error: Call to a member function prepare() on a non-object in C:\xampp\htdocs\trofeugs2017\model\Model.php on line 81 How to fix the error? Code: <?php class Model { protected $name_table; protected $fields; protected $id_row...
asked by 02.05.2017 / 23:06