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
answer211
viewsError check existing Pdo record
I have the following PDO class : <?php abstract class database{ /*Método construtor do banco de dados*/ private function __construct(){} /*Evita que a classe seja clonada*/ private function…
-
1
votes1
answer1439
viewsPDO DBLIB AND UTF-8 ENCODING
I am in a project using UBUNTU-SERVER 64bits as WEBSERVER. In the project I chose the Microsoft Sql Server 2012 database which I have a short-term license to use. With a lot of effort I got the…
-
1
votes2
answers87
viewsMysql PDO array with Json error in view
I’m having a hard time with json_encode echo json_encode($autocomplete -> fetchAll(PDO :: FETCH_ASSOC)); i am doing a database select so far so all right, but when it transfers the data to this…
-
1
votes1
answer157
viewsHow do I make a logical condition by comparing lines from a text file using fopen in php?
I have the code below where he opens the file material1.txt, read to the end and need to make a comparison of one line with another for example: $material =…
-
1
votes0
answers52
viewsDifficulty with Weekly Agenda Display
I am trying to create a weekly schedule that displays the scheduled classes of each day and time, and also leaves the unscheduled schedules vacant. I developed the following code to record all class…
-
1
votes1
answer200
viewsIs it possible to select a table column without entering its name in SQL?
So I was researching but I couldn’t find anything about it, but I need to sort of select the first and second column of the table, without knowing what they are. My code is this: <?php…
-
1
votes1
answer170
viewsError running Trigger mysql
Good afternoon warriors, I’m having a problem implementing a Trigger in mysql. It turns out that I created a table called audit with the same structure of the main table of appointments, this table…
-
1
votes1
answer233
viewsReturn 2 PDO queries in JSON
I need to return two queries. $id = $_POST['id']; $id = end(explode('editarnovoservico', $id)); $searchid = $pdo->query('SELECT * FROM cad_servicos WHERE id = '.$id); $searchid =…
-
1
votes2
answers171
viewsPDO error with variable in LIMIT
In PDO today was the first time I had to put a variable in LIMIT, and I’m getting this error: Fatal error: Uncaught Exception 'Pdoexception' with message 'SQLSTATE[HY093]: Invalid Parameter number:…
-
1
votes1
answer350
viewsPDO PHP: How to make a logged-in user delete their account?
The user accesses the logged in page: <?php session_start(); echo 'Bem vindo, '.$_SESSION['username']; ?> <br /><a href='logout.php'>Logout</a> I want him to press a button…
-
1
votes1
answer1034
viewsInvalid Mysql PHP PDO Data Source
I’m having problems connecting PDO to mysql database. Database_connection.php: <?php class Database_connection { private $db_host = "local"; private $db_name = "root"; private $db_user = "user";…
-
1
votes2
answers101
viewsHow to select a field with MAX()+1 and use in an INSERT?
I have the following code: $Position = $this->conn->prepare("SELECT MAX(OrderTask)+1 as OrderNew FROM tasks"); $Position->execute(); $newPosition = $Position->fetchAll(PDO::FETCH_NUM);…
-
1
votes1
answer589
viewsEditable line with PHP and Javascript
I’m trying to create an editable line, so that when I click on it, Js brings me the inputs, allowing me to make the changes in that line and perform the Update in the database. Like this picture I…
-
1
votes1
answer630
viewsHow to make the return of a Query (PDO)
How can I make the selected Month input bring me the selected user month and year? It is returning the user but when I input the Month to bring the user data for a given month does not come. this is…
-
1
votes0
answers365
viewsHow to use PHP Objects and Mysql Transaction Control?
I have a database with some tables, and I created a class for manipulation for each table of the bank, an example of them is a class for orders and another for itensPedidos. Each class manipulates…
-
1
votes1
answer62
viewsHow to use DNA?
I wonder where I can put the AND tipregistro = 'mysql' so that when you have !empyt and when you don’t have to bring the tipregistro = 'mysql' this is my query public function…
-
1
votes1
answer133
viewsHow to order query using PDO?
How can I sort my query from the latest to the oldest date. This is my Query ? public function RetornaAtualizacoesFuncionarios($data,$codusuario){ $WHERE = array() ; if( !empty( $codusuario ) )…
-
1
votes2
answers528
viewsHow to show the number records in PDO using COUNT( * )?
Hello I’m doing a system that lists in the database the latest updates , even it’s all right , only I wanted to print in the table the number of total updates that the user did . How can I do that ?…
-
1
votes2
answers98
viewsInstantiation problem using Pdo/Fatal error: Uncaught Error: Class
The Following error appears when trying to instantiate and call a certain method: Fatal error: Uncaught Error: Class 'Usuario' not found in C: xampp htdocs Reported projects.php:126 Stack trace: #0…
-
1
votes1
answer21
viewsUnexpected Error in PDO class
I’m breaking the hook with this code for some time now, it’s the first time I’m using the PDO class of PHP and I’m having an error that I don’t know how to solve. <?php include "conexao.php";…
-
1
votes1
answer283
viewsError Object of class daoMaterias could not be converted to string in daoMaterias.php on line 33
At the time of calling up the posting function I find this error : Object of class daoMaterias could not be converted to string, Does anyone know how to solve ? class daoMaterias { private $pdo; /*…
-
1
votes1
answer346
viewsError using PDO prepare() function
I’m on a new project, and I need to use the prepare() of the PDO, I do not know why, but only with him who is giving this error, every time it has some function, or some line with prepare(), PHP…
-
1
votes0
answers64
viewsPDO for DOCTRINE - Haversine formula
I need to transfer the PDO query below to DOCTRINE: $query = $con->query('SELECT *, ( 6371 * acos( cos( radians('.$latitude.') ) * cos( radians( latitude ) ) * cos( radians( longitude ) -…
-
1
votes1
answer1023
viewsCall to Undefined method PDO::bindParam(), how do I fix it?
I’m starting OO studies and decided to take a look at the PDO, only it’s not working. Help me, please: <?php class Cliente { private $nome; private $email; private $telefone; protected $cpf;…
-
1
votes1
answer81
viewsinsertion in related tables
Hello, I am working with some related tables and I can not insert the values in the next rabela, I found that I need to recover the last id inserted in the still can not use it, without the relation…
-
1
votes0
answers167
viewsError connecting to pdo_mysql when using Docker with apache and mysql
I’m using Docker with apache 5.6 + mysql: Mysql Oficial Docker PHP Official PHP - Version 5.6 I first ran the mysql image, then ran the following command line to run the apache image, linking the…
-
1
votes1
answer311
viewsHow to gather data from two queries in a php object?
I’m doing two comic book queries at different tables. With the data of the first query I am taking data in the other, however, I can not join all the data in a json object only. <?php…
-
1
votes1
answer221
viewsInsert and PDO problem
I am trying to make an Internet with PDO. For this I use: controller/con_clients.add.php <?php if($action == "new_client"){ $search_cod_cliente = $pdo->prepare("SELECT MAX(cli_cod_cliente) AS…
-
1
votes0
answers168
views -
1
votes1
answer608
viewsPHP PDO for SQL SERVER
Good afternoon, I am trying to connect with my PHP pages in MS SQL SERVER using PDO, but I am having difficulties. I tried to use the PHP manual, but I’m getting confused and I’m not getting it. The…
-
1
votes0
answers789
viewsProblem with extension of Postgres PDO
Use apache+php7+postgres on Ubuntu and it works well. But now wanted to do the installation by hand on Windows 8.1 and found a problem: I installed Apache 2.4, PHP 7.1, and Postgres. Apache worked…
-
1
votes1
answer2582
viewsListing data from a table with PHP
Hello, I’m trying to make a list with data in a table with the code below, but I’m not getting it. I’ve done several ways, I’ve seen tutorials on the Internet and everything, however, it comes to…
-
1
votes1
answer205
viewsProblems with PDO
I’m new with PHP and would like to ask a question: In the code that I will show below, has been tested the consultation in the bank until the try, the problem is that after the try(){} the prepare…
-
1
votes2
answers1019
viewsPDO Statement Dúvidas
I wonder if when I use the queries for SQL commands with PDO I need to use bind(): $SQL->bindValue(1, $email, PDO::PARAM_STR); // Seria algo assim? For example in this case: $searchSQL =…
-
1
votes0
answers156
viewsWhat is the advantage of passing the parameter type in bindValue?
Observing the reply of this question, I noticed that the user recommends to pass the parameters by the function bindValue, indicating the type of parameter. There is a various types of parameters…
-
1
votes1
answer842
viewsFatal Error: Uncaught Error: Call to Undefined Function getList()
I need to reuse this function so that it uses fetchAll but also use num_rows, the problem is that if I return fetchAll or num_rows it works, but in that case I would have to create two functions…
-
1
votes1
answer994
viewsPDO sqlsrv is in phpinfo but does not work
I’m trying to access an SQL Server server from another Ubuntu server 16.04 using PHP, I did the entire installation process of the drive informed by Microsoft’s own website and phpinfo is shown the…
-
1
votes0
answers282
views'SET ANSI_WARNINGS ON' Orange 5.4
I am using Laravel 5.4 with 2 connections, one of them is just to access some Views of a Sql Server database, and one of them makes a LINKED SERVER which forces me to set some settings before making…
-
1
votes2
answers868
viewsExecute() from PDO returns false
I am practicing object-oriented PHP (POO) and I am developing a system for enrolling students, but when I try to register a student or execute() returns false and I couldn’t identify the problem.…
-
1
votes1
answer44
viewsMontart loop with variables for PDO exclusion
After a filter I have this form with the users and their services, what I am trying to do is send the information to delete the records with the parameters set in the form, in case it would be the…
-
1
votes2
answers560
viewsaccentuation problem when saved in the database
There’s a problem with me, when I save a value in the database, it saves without accentuation. All my code on the page is utf8, all my database is utf8, the tables are utf8 and where does the Insert…
-
1
votes1
answer126
viewsRecovers values using classes and Pdo without going through the url
Good afternoon, I have a class where I pass all the methods insert, update, delete, consulta(fechall) and consulta(fech($id)) Below I show the class of consulta(fech($id)) public function…
-
1
votes1
answer1683
viewsHow to count rows from a table with PDO
I’m trying to get the number of lines a Select to show or not some messages to the user, but all possible attempts did not return me the correct result. What I’m using is a William Francisco Leite…
-
1
votes1
answer88
viewsConnection error using namespace
I have a file that is responsible for the connection to BD and is in PDO. <?php namespace clientes\model; class conexaoPDO { public static $instance; private function __construct() { } public…
-
1
votes1
answer58
viewsquery Pdo error (Sort by Count)
I am trying to make a ranking based on the amount of coins each. In descending order. I used this query in Pdo: $ranking = $pdo->query("SELECT * FROM usuarios WHERE banido='false' GROUP BY…
-
1
votes0
answers32
viewsProblem with SELECT and bindParam()
When adding bindParam() after preparing the query, you are giving an error in execute, which says the following: Fatal error: Uncaught Error: Cannot pass Parameter 2 by Reference in C: xampp htdocs…
-
1
votes1
answer589
viewsHow to get the results of two tables by consulting one with PDO?
I have the establishment table, unit table and professional table. In the unit table, I have the idestablishment. On the professional table, I have the skill. I need to pull all the professionals'…
-
1
votes1
answer76
viewsProblem returning data with Mysql PDO
I have a query that returns the permissions of a certain group of users of my system. I use Mysql with PHP. My SQL command is as follows: select p.Codigo, p.Descricao, (case when gp.CodGrupoUsuario…
-
1
votes0
answers28
viewshow can I create and model a table with attributes in the database with the PDO using array?
I’ve already got this method following some examples I’ve seen around but I still don’t quite understand how I’m going to go through this array and turn the table attributes public static function…
-
1
votes0
answers44
viewsBack-End MVC (Laravel) Real Time with Json
I took a course of Laravel, and I made my application in MVC, however, there are some balloons, which I press in JSON, click on the button "login", open the balloon login, in it there are functions…