Most voted "pdo" questions
The PHP Data Objects (PDO) extension defines an interface for accessing PHP databases. Each database driver that implements a PDO interface can expose database-specific features as normal extension functions.
Learn more…927 questions
Sort by count of
-
-1
votes1
answer29
views -
-1
votes2
answers111
viewsMove row to another table in the PHP PDO database
I have a table of movies on my site that has the option to edit and delete. I’m having a hard time deleting the film from my chart. What I want to do is: When you click delete, it moves the row to…
-
-1
votes1
answer113
viewsPDO Bindvalue - Array Where
Good afternoon. I am creating a form where the user selects some fields to formulate a query and thus generate an sql to be executed and returned. After validating the fields, I create a…
-
-1
votes1
answer2147
viewspass two parameters via GET
Hello, I am doubtful how I can pass 2 parameter via GET, only the second would be after the answer of the first. what I want to do is select an item in an input select and update the page with that…
-
-1
votes1
answer96
viewsClass does not connect with PDO to the database and another class in the same path yes
I’ve got the spread connection: <?php namespace classes\conexao; use PDO; class Conexao { private static $instancia; private static $host = "localhost"; private static $db = "mvc_crud"; private…
-
-1
votes1
answer20
viewsError in generation of sql with datetime
I got the following method: public function inserir (ClientesModelos $_cliente) : bool { $sql = 'INSERT INTO clientes (data, nome, sobreNome, nascimento, documento, telefone, celular, email, senha,…
-
-1
votes1
answer195
viewsWhat is the best practice for running select after PHP Insert?
After making an insert in the database, I return the newly created id and then make a get of this same id to perform another function. But as it is all very fast, the get comes before you have all…
-
-1
votes1
answer681
viewsSelect with PHP PDO and Mysql with conditional query values
I have the following table, called 'animal'': And in my PHP application using PDO, I need to select values that are conditional. For example: The user will pass as a parameter only the 'TYPE' and…
-
-1
votes1
answer348
views -
-1
votes3
answers81
viewsHow to remove the login button after starting Session in php Pdo?
I wanted to know how to shoot the login and put one welcome after login: //codigo q faz o login $sql = "select id, nome, email, senha, ativo from usuario where email = ? and ativo = 'S' limit 1";…
-
-1
votes1
answer100
viewsI’m getting this error while trying to connect mysql: Fatal error: Uncaught Error: Call to a Member Function prepare() on null
php connection. try{ $conn = new PDO("mysql:host=$servidor;dbname=$banco;charset=utf8", $usuario, $senha); return $conn; }catch(PDOException $e){ throw new PDOException($e); } base php. require…
-
-1
votes1
answer589
viewsPdostatement::execute(): SQLSTATE[HY093]: Invalid Parameter number
Good evening, Folks. I’m getting the following error: Pdostatement::execute(): SQLSTATE[HY093]: Invalid Parameter number: number of bound variables does not match number of tokens in C: xampp htdocs…
-
-1
votes1
answer195
viewsGroup two columns into two mysql tables
I have two tables that I am joining to recover the related data in this way: Tabela Processos: Tabela Anexos id | processos processoid | titulo 1 | Processo 1 1 | REQUERIMENTO 2 | Processo 2 1 |…
-
-1
votes1
answer111
viewsPHP with PDO returns full SQL date
I have a PHP application that reads data from tables that can be SQL or Postgres. When I started using PDO instead of mssql, the SQL data fields return ex: 'Nov 29 2019 12:00:00:AM'. If you query…
-
-1
votes1
answer40
viewsLogin PDO PHP com prepare
I’m having problems with Login No error appears, but it seems that the program stops when trying to select <?php ob_start(); session_start(); include("conn.php"); $conexao = getConnection();…
-
-1
votes1
answer98
viewsSearch for two columns in the database
I need help on how to do a two-column search, I’m a beginner. If I type a category it finds, if I type a city it finds, however, if I type category and city ex: agencies são paulo he returns…
-
-1
votes1
answer123
views -
-1
votes1
answer26
viewsMysqli lastinsertid for PDO
I have an insert page, as soon as I click insert new accommodation, the system should insert some ready data, but on the same page I need to recover the last id, so that I can complete the other…
-
-1
votes1
answer649
viewsHow to check if Cpf and cnpj already exist in the database (Pdo Php)
I’m trying to do a check when I want to register a customer. Before registering I want to check if the customer’s Cpf or cnpj already exists in the database. when I try to check only Cpf it works…
-
-1
votes1
answer188
viewsHow to fix "Call to Undefined method Dbconnection::prepare() in Userdao.php on line xx" error?
Meu projeto tem a seguinte estrutura: project \inc \DAO UserDAO.php \Entity User.php \Config AppConf.php DBConnection.php form.php login.php And the following files: Dbconnection.php class…
-
-1
votes1
answer54
viewsAccess data from two databases of two different tables in a query
Guys, I’m having a problem. Currently I have two databases and two tables (1 table in each database) that need to be connected in one query only. It would be a JOIN in other words, but I’m not…
-
-1
votes1
answer70
viewsProblem using PDO::bindParam with table names
I am a beginner in programming and wrote a code in php to practice PDO. However, I had a problem: when I use the Mysql command without bindParam it works normally. When I reference the table name…
-
-1
votes1
answer56
viewsLoop While and Foreach (PHP & JS) problem
I have two values from two different columns in the database: Column: Laitude, Longitude.I have stored values within each column of the table: Location. I want to list all the values of Latitude and…
-
-1
votes1
answer42
viewsINSTER MYSQL PHP PDO ERROR
I’m trying to make an Insert using PHP PDO, but it is always returning an error, which I am not able to solve $insert = "INSERT INTO usuarios ('usuario', 'senha', 'telefone', 'email', 'tipo',…
-
-1
votes1
answer64
viewsFilter with select using Javascript and php
Hi, I’m trying to make a filter according to the option that is chosen in a <select>. I have a button that executes the function created in javascript. I have variables declared in php, and I…
-
-1
votes1
answer31
viewsHow to put more than one Get method along with the sql code to send the information in the bd ? Example: Put email and password
Php user. #Conexao/categoria.php include_once 'conexao.php'; class UsuarioDAO{ public function Inserir(Usuario $usu){ try{ if (!empty($usu->getNome())){ $sql = "INSERT INTO usuario (nome) VALUES…
-
-1
votes1
answer42
viewsConfirm registration by email - PDO
I am trying to make a confirmation of registration by email, but I am not succeeding. I can get the user, email and password. but when I echo the $id and $md5 variable to check the data nothing…
-
-1
votes1
answer51
viewsReturn query with PDO to Bootstrap card
Good morning to all, Was using query with mysqli and returning to card in bootstrap, follows code snippet. <?php require_once("conectar.php"); $comando = "SELECT * FROM agendamentos ORDER BY id…
-
-1
votes1
answer27
viewsI’m trying to create a form using PHP with PDO database
When I put the information in the form and click to insert the following error appears: SQLSTATE[42000]: Syntax error or access Violation: 1064. Code below: php connection. <?php…
-
-1
votes1
answer41
viewsFailed to convert nvarchar'Array' value to int data type
Hello. I’m having some trouble inserting values into a table. Explaining better, I get the AID generated in Account and need to insert it in Login. I was successful in consulting the AID generated…
-
-1
votes1
answer79
viewsIs there any way to recover which Pdostatement in the PHP PDO was created?
You see, I use PDO in PHP to run my Querys, sometimes I use the same query in other windows and then I need to rebuild the same Query on the other page. What I have in mind: I want to save select on…
-
-1
votes1
answer70
viewsCan someone give a hand with my Paging code with php PDO
Hello good morning, someone could help me with this paging code with php and PDO it works normally but only gives me the option to go to the first page and the last. I can’t get to the next page or…
-
-1
votes1
answer35
viewsHow to dynamically assign a column name to a query using PHP PDO?
I’m trying to create a update query, in order to define the column name to be updated dynamically, but for some reason I cannot do this. Why? And how can I do that? My current code: //atualizando…
-
-1
votes2
answers55
viewsLogin php always returning empty
I am making an application and I have the following problem: I register a user, it shows in the database, when trying to login, even filling the fields correctly, the SESSION['em_white'] always…
-
-1
votes1
answer37
viewsMysql connection within a class
Hello, I’m having a hard time making a connection to the database. To make the connection I created a class called Conexao and I am using PDO, when I need to make a select, for example, I call the…
-
-1
votes1
answer36
viewsFill table with database data via Ajax
I am very confused. I am creating an application with PHP and PDO. I have a page where there is a table with my database data. At first, it already makes the query in the bank and stores the result…
-
-1
votes0
answers11
viewsPutting Prepare Inside or Outside the Loop? PDO + PHP
I use "prepare" PDO for everything, so optimizing my application I saw that I may be doing something "wrong" at the time and I didn’t even think it was the following: I have a "Database" class that…
-
-1
votes0
answers31
viewsInsert with PHP in SQL SERVER
Through the POST method I am sending the form data. However at the time of the insert INT type fields in the database give the following error: "sqlsrv_rows_affected() expects Parameter 1 to be…
-
-1
votes0
answers9
viewsFatal error : Undetected error: Call to a member function run() on bool in C:
The following error in my code is occurring: Warning : PDO :: query(): SQLSTATE [HY000]: General error: the mode must be an integer in C: xampp htdocs joel_php curso_hcode DAO sql.php on line 34…
-
-2
votes1
answer84
viewsHow can I correctly use a PDO object for a selection query
i followed the recommendations of php.net, to make a select in a certain database using PDO, however I do not know if I am doing it the right way, I wonder if you can help me $duosig = "SELECT…
-
-2
votes2
answers90
viewsDestroy Session when changing profile on mobile and affect pc
Hello, How do I solve the problem when someone edit the profile on mobile and at the same time is logged in on the pc, do not give php error as 'Undefined variable' on the pc because the data is no…
-
-2
votes1
answer131
viewsPdoexception error
Hello, I’m having difficulties in hosting a php system, initially I developed with xampp (localhost), however, when host is not making the Mysql connection for what I understood.. Error: Exception…
-
-2
votes1
answer94
viewsI’m having trouble saving input data to a mysql table via PHP
I’m trying to understand why I’m making a mistake at the moment I will save the entered data to us input in a mysql table via PHP? does anyone know how to solve? <?php require_once…
-
-2
votes1
answer25
views -
-2
votes2
answers101
views"Catchable fatal error" PHP error
I have a field search in which put a dynamic date, posting this date returns me the records of the bank below, but I stuck in this error that happens in foreach. Follows code: DAO: public function…
-
-2
votes1
answer86
viewsHelp with Mysql connection
I’m creating a CRUD system for practices, and my code is making a mistake in mine prepare(). Index.php <?php require_once 'core/init.php'; // Abre a conexao com o banco de dados $pdo =…
-
-2
votes1
answer1151
viewsColumn id with Primary key and auto increment is returning null MYSQL PHP
Good evening guys, it is the following, I have an application that was working until these days, then today when I went to add a post in the database, my id_post that is Primary Key and…
-
-2
votes1
answer74
viewsHow to return data from a class within an option
Good afternoon, people, I have a problem. I’m a beginner in object-oriented programming and I’m trying to make a select/option that gets values from within the database in an employee table. The…
-
-2
votes1
answer89
viewsOptimization in PHP PDO code
hello, I’m studying a way to increase a value before storing in the database but I need help, searching Google for parts I was able to assemble the code and yes it works, goal is to update a value…
-
-2
votes2
answers91
views