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
-
0
votes1
answer46
viewsHow to "raise" classes in the bank using also confirm javascript
Hello, I have the following code and I need to pick up a student’s class at the bank and if yes to confirm in JS: "climb" your class. Ex: The student is 1A, I press the button to go up and he needs…
-
0
votes1
answer53
viewshow do I page other results
I saw this code and used it in my project, and it worked, but it only displayed the 10 results to which it was limited. I would like to know how to paginate for the other results using php Pdo.…
-
0
votes0
answers32
viewsData is not entered into the database using PDO
With a problem, basically the data is not being entered in the database, and is not showing error, I am still beginner, and I can not understand where the error is: Script: require_once…
-
0
votes0
answers72
viewsI can’t run Precedent in PHP - Fatal Error on the execute line( )
I cannot run a precedent by PHP, at the time of sending the PDO execute displays the image error, in my base oracle the Procedure runs normally. I tried to make it display the SQL error but failed…
-
0
votes1
answer53
viewsVerifies Registered User
I’m using this topic as an example of implementation. /a/76694 It works, gives me the message that there is already a registered email, BUT if I click register it registers anyway, ignoring the…
-
0
votes0
answers53
viewsinsert data into a table with PDO
Hello, I’m doing my first PDO code but when I am running the code, it brings me a mistake that I have no idea what it is, I appreciate the help from now. <?php session_start();…
-
0
votes1
answer224
viewsHow do bindValue in PHP when the value is an array?
I’m trying to pass more than an id to search in my program but the search only brings an object with the data of the first id, query code in sql: public static function listar_servidores_ids($id){…
-
0
votes2
answers192
viewsHow to update the database from a form using PDO?
I have 2 files, the 1° is the form q will carry out the sending of the data and the 2° will process the data and update in the database, but the problem is q this is not happening, follow the code…
-
0
votes2
answers50
viewsHow to query 2 columns in a single input text
Hello, How do I use a single input text to query 2 columns? Currently my code has an input=select and an input=text but in the text I want to see 2 columns.. how do I do this in the sql query? Note…
-
0
votes1
answer181
viewsInvalid Parameter number - PHP
I’m using the same code I use to make the UPDATE from another table in my bank, but when I use the code for my bank’s post table error, the only thing that’s changing is the image. I have no idea…
-
0
votes1
answer67
viewsCan anyone tell me why if Else is not returning Is it?
Come on, guys, I’ll try to be as enlightening as possible on the question. Next: I have an if Else that is done by a Pdo query, when I type an existing Cpf it does the job properly, until then ok!…
-
0
votes1
answer29
viewsSet the name of the select input from the database
How do I make the item description (coming from the bank) appear in select instead of the phrase "Select Equity Account" I want it to appear: $listar3["DES_CONTA_PATRIMONIAL"] for the selected item.…
-
0
votes0
answers239
viewsUpdate with Ajax + Pdo
I performed the UPDATE with AJAX + Pdo, however, it is affecting only one line, the others are not affected. I’ve tried a lot of things, but I can’t seem to figure it out, if anyone can help me.…
-
0
votes1
answer91
viewsDate|Time returning error
I have the Model class down below: namespace classes\mvc\modelos; use \DateTime; class ClientesModelos { private $idClientes, $data, $nome, $sobreNome, $nascimento; public function __construct (…
-
0
votes1
answer60
viewsPDO - Showing bank information
While trying to connect to Database without internet connection the program shows me this error message: Fatal error: Uncaught PDOException: SQLSTATE[HY000] [2002] Network is unreachable in…
-
0
votes0
answers31
viewsPDO displaying the populated query
Well, here’s the thing function: public function inserir (ClientesModelos $_cliente) : bool { $sql = 'INSERT INTO clientes (data, nome, sobreNome, nascimento, documento, telefone, celular, email,…
-
0
votes1
answer103
viewsTake Database info from the array element
I’m making a cart in php. What I want is to get the name of the product (which is in the database) from its id, which is the value of each position of the array. However, since there are multiple…
-
0
votes0
answers52
viewsInsert with lastInsertId() error
The code below only inserts in the requested table, already in the requested product has_does not insert. What error ? public function criarPedido(){ $consulta = 'INSERT into pedido(data,…
-
0
votes1
answer326
viewsProblems with external SQL Server connection in PHP
I am with a problem for days with an external connection PDO sqlsrv, I have scanned the internet and I did not find a solution. I installed all sql server drivers for PHP, including, I installed sql…
-
0
votes1
answer48
viewsDelete comma separated records
I am uploading several images and storing them in the bank, so far it is perfect. The records are recorded, separated by comma in the field materialDocumento on the table tb_material. The problem is…
-
0
votes0
answers195
viewsUPDATE of information in the database with PHP using PDO
I’m trying to do an update after sending the data through the form but I can’t, it just doesn’t update anything. I check the data by $_GET['id'] and the $_POST is passing values and everything is…
-
0
votes1
answer330
viewsFatal error SQLSTATE[42000]
Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for…
-
0
votes2
answers362
viewsHow to connect PDO with named Sqlserver instances?
I can’t connect PHP 7.0.36, sqlsrv PDO drive on Ubuntu 16.04 on SQL Server 2012 when the database has a appointed body. When do I use the standard instance works. $conn = new…
-
0
votes1
answer159
viewsPHP: Add new element to an array created from an object
Hello, I have the following class in models/cliente.php: <?php class Cliente { public $id; public $nome; ... public function __construct($id, $nome, ...) { $this->id = $id; $this->nome =…
-
0
votes0
answers141
viewsPHP PDO call Procedure and then select from temporary table
I have a protocol that creates a temporary table and I need to select it right after. I’m using Pdo and always returns some error, in my last code gives error 500 and do not know where to go. $proc…
-
0
votes2
answers79
viewsError with bind_param() with mysql PDO connection
if anyone can help me error in the script I really appreciate, the error is as follows: Fatal error: Call to Undefined method Pdostatement::bind_param() in the code is this:…
-
0
votes1
answer100
viewsError using PDO and Autoload
I’m having a problem making a PDO call inside a file that works with an autoload, I believe autoload tries to load everything , even the PDO. <?php function load($namespace) {…
-
0
votes0
answers268
viewsMethod that takes all data returns empty JSON in the API
I’m developing an API based on code from a publication I saw on the internet, source: https://www.w3jar.com/crud-rest-api-in-php-pdo/ This file has a condition, if I pass an ID it returns a good…
-
0
votes1
answer318
viewsProblem doing password update in DB. - PHP, PDO, MYSQL-
I am calling a function from a class. This function is used to change the user password in db. The class file contains: <?php class Usuario { private $pdo; /*criando variavel para usar nas…
-
0
votes1
answer176
viewsRecover instantiated object in another file in PHP
Quick question: how to recover the instance of an object created in a different file in a PHP application? Full question: I am creating a project for PHP studies where I have the file conn.php which…
-
0
votes1
answer401
viewsReturn the last ID with PDO in PHP
I need to get the last id inserted, I tried using lasInsertId but I’m not getting it, I don’t know if I ran wrong or so on, but here’s the code of my connection and PDO functions. The error remains…
-
0
votes1
answer90
viewsDoes the Pdostatement bindValue() not work with the table name?
Well, I have this code: public function Ler($tabela="funcionarios"){ $this->sql = $this->pdo->prepare("SELECT * FROM :tabela"); $this->sql->bindValue(':tabela',$tabela);…
-
0
votes0
answers411
viewsQuery with like and or with PHP variable
I have a form with two inputs one type text and one type date. I am trying to make a query where the result should be filtered either by name field or by birth date field or by two together. It…
-
0
votes1
answer85
viewsdata mask with php
I am trying unsuccessfully to replace the values returned from a database field, which returns a ckeditor html code. I’m trying to do it this way: $class = new Selecionar();…
-
0
votes0
answers46
viewsInsertion with PDO
I’m using the PHP with the objects PDO and Pdostatement, and my code does not portray any errors or Warning, I did the verification of the variables were passing with print_r and is normally, but…
-
0
votes1
answer295
viewsPDO bindValue PHP
I’m studying PHP and I’m seeing object oriented PDO but I realized a connection already tested, however the bindValue returns error at time of execution, this error: Fatal error: Uncaught Error:…
-
0
votes0
answers200
viewsHow to verify if any record has been returned, the amount of it and if any record has been changed in a query with PDO and Mysql?
After performing a query (An INSERT or UPDATE) I would like to know if any changes were made in the database or if nothing happened. With Mysqli I used mysqli_affected_rows. However, I don’t know…
-
0
votes1
answer86
viewsHow to return a query column within a class
I’m updating my entire project to object-oriented PDO, but I’m having some difficulty returning a fetch column in the class query User. After several attempts, so was my code: user php. Class User {…
-
0
votes1
answer32
viewsCall bindValue for $this->... or direct for $_SESSION?
The code where my doubt is.. public function queryFixClayTime($data) { if (session_status() !== PHP_SESSION_ACTIVE) { session_start(); } if ($_SESSION['claytime'] >=…
-
0
votes0
answers43
viewsSchedule Deletion of Record
Hello, how are you? All right? I’ll explain my situation and already show you what I have, come on: So, I need to schedule the deletion of a data from SQL, I have a system that publishes polls, in…
-
0
votes2
answers111
viewsPhp and Pdo - Data insertion are being duplicated
This question has already scored here and there on the forums and, most of the time, the programmer really was, for several reasons, commanding the Insert twice. But I guess it’s not my case. I’m…
-
0
votes1
answer80
views -
0
votes0
answers269
viewsUncaught Error: Call to a Member Function prepare() on array
Environment: php 7.4.4 and Apache24 on a Microsoft Server R2 2012. @EDIT: MS Sql Server Database. Guys I’m getting the following error: Fatal error: Uncaught Error: Call to a member function…
-
0
votes1
answer109
viewsmake SQL query return in an organized way
I have the following SQL table: |`id` | `user_id` | `key` | `value` | |------------------------------------ | 1 | 1 | nome | João da silva, 50 | 2 | 1 | docs | 552.282.820-58, 22.532.25,…
-
0
votes1
answer36
viewsbindValue error - php mysql connection
I’m making a login system using php and mysql. But I’m having an error that I can’t solve. Fatal error: Uncaught Error: Call to a Member Function bindValue() Could someone help me ? follows below my…
-
0
votes3
answers173
viewsMysql query return with PHP+Javascript
I’m creating a PHP query in a Mysql database. So far so good. The query works fine. I’m calling the query from a javascript using $.post('pagina.php',meusparametros,function(resultado){}) to insert…
-
0
votes1
answer52
viewsINSERT INTO table1 SELECT * FROM table2 USING PDO SQLITE3
Hi, it’s been a while since I’ve been searching the entire internet and trying to make this query work. In the database works, however, I need to make my application run this query, I use PDO in PHP…
-
0
votes3
answers101
viewsDetermine when Loop WHILE should stop PHP
I have the following problem, I have a system in PHP that makes a WHILE in a column of the database that contains certain values and I need WHILE to stop at a value that I determine. The first…
-
0
votes1
answer57
views -
0
votes1
answer63
viewsSelect SQL SERVER PDO data for a select list with PHP
Dear ones, I have designed this code snippet so that the data received from my SQL SERVER database is listed in a select via PDO: consultationphp.: <form name="cargo" method="post"…