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
answer341
viewsHow to get select to be populated based on the variable selected in another select
I need to make that after choosing the product, in the quantity select display a list with the values according to the available quantity, for example: if you have 10 pieces of a pants, display the…
-
0
votes0
answers270
viewsCategories and subcategories in a single SELECT
I have the following table structure: CATEGORIAS id titulo SUBCATEGORIAS id id_categoria titulo I was wondering if there is a way to bring all categories and subcategories at once into a single…
-
0
votes1
answer863
viewsHow to take the value of a php variable and use it in the ajax request
I am creating an order page with the code below, what I want is that when choosing the quantity of the product, it already appears the total value of product x quantity. If I set the value var…
-
0
votes0
answers53
viewsAJAX does not update div by id
I am developing a login system, where I need to return the validation message to the user in a div on the login page itself, however the error message is appearing on the validation page. I’m using…
-
0
votes0
answers69
viewsBring data without repeating id
I have a table with the name of Posts table, I have a table with the name of Users table, I have a table with the name of Relations table. Now what happens is that this Relations table works as…
-
0
votes0
answers42
viewsDo not save Array of value 0 in the database
Guys, I have a form with 'n' quantities of inputs, all with the same structure: echo "<input name='quantidade[]' type='number'>"; When I finish the form and send it to the next page, they come…
-
0
votes1
answer164
viewsWrite data to 3 PDO related tables
I need to input data into 3 tables related using the PDO. The first table t_repo_proj (repositórios), and the second t_grnte_proj (gerentes). I need to know which manager is associated with which…
-
0
votes1
answer54
viewsFETCH_CLASS does not arrow parent class values
I am using FETCH_CLASS to map the classes, but when for example one class inherits another, FETCH_CLASS does not find the attributes of the parent class and ends up creating new attributes class…
-
0
votes2
answers56
viewsCount Database output
hello. good night. I have a question I want to add up all the field values valor_reais of my table for example id 1 = 150 id 2 = 100 id 3 = 100 I want the obvious result, 350 I’ve tried something…
-
0
votes0
answers360
viewsSecurity in checking and validating user with PDO:PHP
I want to create a panel with a secure login environment, using PDO as a validation. To explain, I am using the IPB forum database, basically I want to take advantage of the same forum user and…
-
0
votes0
answers17
viewsBindvalue error (or INSERT)
Warning: Pdostatement::execute(): SQLSTATE[HY093]: Invalid Parameter number: number of bound variables does not match number of tokens in C: xampp htdocs teste all_processo.php on line 92 Error…
pdoasked 6 years, 7 months ago Bernardo Rodel 27 -
0
votes1
answer176
viewsPHP PDO transaction with multiple objects
The idea would be this: I have 3 classes, one for connection to the bank, another for Users and another for Product. The User class with the database tb_usuarios. The Product class with the database…
-
0
votes1
answer99
viewsOrder taking only the last registered product
I am creating a simple system to make order reservations, where I bring the products from the database through a simple while, but if I try to put brackets in my Ames, example name=name[] it brings…
-
0
votes1
answer35
viewsPDO eliminates SQL field duplicity
Good guys, I’m using PDO to run my querys. SQL: SELECT Pessoa.IdPessoa, Pessoa.IdPessoa, Pessoa.Nome AS 'Nome', Pessoa.DataNascimento AS 'Nascimento' FROM Pessoa WHERE Pessoa.EstadoCivil = '1' when…
-
0
votes0
answers37
viewsUsing PDO with PHP
Good morning, created a function to get the ids of all processes of a table, as shown in the code below function getProcessos() { $conecta = new PDO('mysql:host=localhost;…
-
0
votes0
answers47
viewsInsertion and removal using PDO in Onetomany and Manytomany relationships
I beginner questions about inserting and removing using PDO in such relationships Onetomany and Manytomany. Example: class Livro{ private $id; private $titulo; private $generos; //Livro tem mais de…
-
0
votes0
answers36
viewsHow to fetch the product by its title?
I am trying to search for the title of the product, but regardless of the title consulted, it always returns me the last record of the Product table. I am using the following code below to run the…
-
0
votes3
answers101
viewsForm data is not sent to the database
I’m having a problem sending data from a form to the database the script runs without pointing out an error apparently but does not enter the data someone would know the problem follows the code :…
-
0
votes0
answers34
viewsInclude PHP(PDO) class
Well, I started my PDO studies recently, I’m trying to include a class in a form, but it’s giving the error: failed to open stream: This either if I use direct include with the path, or if I use…
-
0
votes1
answer32
viewsSelect from two columns showing also what is not related
Hello, I’m having the following difficulty: I’m using a Select that encompasses two tables tb_illness and tb_vaccine, but it does not display all values. EXAMPLE On the table tb_illness there are 33…
-
0
votes0
answers131
viewsError with fetchAll using order by
I’m making a task scheduling system. I need to show these tasks to the user, created a file called tarefas.php to query the Mysql database: <?php include_once 'conexao-calendario.php';…
-
0
votes2
answers335
viewsJson does not return data from Mysql database
I have a table in the database Mysql which contains 3 fields ( id, name and template) different from the other fields, the email template data with tags HTML (structure in longtext). When I execute…
-
0
votes1
answer110
viewsLogin with PDO does not check number of select results
I am starting a new system only that instead of procedural I am using O.O. and PDO, I started to login, but even select returning the value, PHP shows that user or password is wrong... Login method:…
-
0
votes1
answer1040
viewsThere is no active transaction error
I started studying PDO these days, and I started doing a CRUD, but when I give the Insert it shows the error: There is no active transaction I tried to see in other related questions, but did not…
-
0
votes0
answers64
viewsProblem with GET Request
I am successfully using the script below to open in Visual DIV, products related to selected brand: Link to the Brands: <a class="marca" style="cursor:pointer;"…
-
0
votes2
answers436
viewsReceiving HTTP POST Json with PHP MYSQL PDO
I’m having a hard time solving a problem and I’m counting on your help. I am receiving, from an external API, an HTTP POST request in JSON format with some information. I need to take this…
-
0
votes1
answer122
viewsConversion of SESSION Mysql to SESSION into PDO
How do I convert this SESSION below Mysql to PDO. <?php if(count($_SESSION['carrinho']) == 0){ echo '<tr><td colspan="5">Não há produto no carrinho</td></tr>'; }else{…
-
0
votes2
answers156
viewsPHP does not recognize connection as parameter
I’m making a system using MVC (first time I use it in PHP), and when I will login appears: Uncaught Argumentcounterror: Too few Arguments to Function Login::login(), 2 passed in C: wamp64 www…
-
0
votes1
answer179
viewsWhat does PDO Prepare do when we use it?
What exactly prepares it does? For example, does it encrypt, or something like that? Because, to be honest, I use the method, but I never really understood its use. <html>…
-
0
votes1
answer475
viewsError trying to insert - Call to a Member Function prepare() on a non-object
I am trying to check before if a field is repeated in the database, but while running the file I get the following error: Fatal error: Call to a member function prepare() on a non-object in ***** on…
-
0
votes0
answers294
viewsUpdate only div with ajax
I have an ajax code that sorts items from my table, what I need is for it to refresh only in the div ID Imagery Name Slug Order Situation Action <tbody> <?php foreach ($list as $row) {…
-
0
votes1
answer58
viewsDoes anyone know where the error in this code is?
The error that is generated me is the following: Notice: Only variables should be passed by Ference in Can anyone tell me how to fix it? According to the error, it’s in this part: $extensoes_aceitas…
-
0
votes1
answer40
viewsPDO error - Call to a Member functio on null
I created a function to make a query in the BD and return a User from the variable $nome passed by parameter, however, when testing it enters the Else, someone would know where the error is? Note:…
-
0
votes0
answers28
viewsHow to use PDO and PHP to Show in Table Query Data
I have a question. I do not understand why my code is not correct. Please, if you can review it, I would be very happy. <?php require_once "db_connect.php"; //conectar banco $conectar = new…
-
0
votes1
answer42
viewsProblems inserting data into multiple tables using Pdo
Hello, my case is the following, when tables are empty all fields are normally inserted more if I try to enter more data the system returns an "Alert" which occurred an error while registering.…
-
0
votes0
answers96
viewsPDO DAO PHP doubts on Insert
I’m trying to make an Insert using Pdo and dao, I have little knowledge in the case, I did on top of a model that works very well, only when I do with more fields and another bank the code does not…
-
0
votes1
answer275
viewsIs it recommended to use a global variable for a PDO object?
Below I will pass an example of how I use today the PDO connection to access my databases. I would like to see with you, if it is a good practice this way, or if it is recommended a safer and more…
-
0
votes1
answer138
viewsPass variable in UPDATE PDO PHPERRO: Pdostatement::execute(): SQLSTATE[HY093]
@$c_matricula = $_POST['numero']; @$data_aa = $_POST['data_aa']; @$data_ff = $_POST['data_ff']; if(isset($data_aa)){ @$dataa = date("Y-m-d H:i:s"); $pdo = $dbconn->prepare("UPDATE contato SET…
-
0
votes2
answers164
viewsShow Json + Mysql + PHP Value
I need to do this, but coming from the database.... I don’t know how to do it... function decodificar($id) { if ($id == '1') { return json_encode( array( 'id' => '1', 'desc' => 'descricao do…
-
0
votes0
answers27
viewsError in function to list user data
I’m having the error below when listing a user’s data by function lista(). Parse error: syntax error, Unexpected 'name' (T_STRING) in /home/adelanmu/public_html/usuario-class.php on line 54 public…
-
0
votes2
answers118
viewsInsert with two tables
Follow my code, first query with information from student table. Second query with information from pay schedule. In my register, I have the information of students and payments together. I want to…
-
0
votes1
answer81
viewsinsert only one field with Pdo
Eae you guys, my problem is the following am using php’s PDO object to insert records into the database, the problem is when I try to insert only one field into a table example: $query = 'INSERT…
-
0
votes1
answer54
viewsLIKE with explodes PDO
Good night consecrated, I have a search page, in which I want that when someone searches something like "i3 memory screen cabinet" appear all the items available in the table with respect to these…
-
0
votes0
answers29
viewsPdo code help for mysqli
Code ok ! -:PDO:- correct code working header('Content-type: application/json; charset=UTF-8'); $response = array(); if ($_POST['delete']) { require_once 'dbconfig.php'; $pid =…
-
0
votes1
answer74
viewsProblem with PHP Expense Calculation
I’m trying to calculate expenses in the system but I’m not succeeding. The system works as follows, the User makes an order involving 1 or more products, these orders are stored in a table. Each…
-
0
votes0
answers32
viewsSelect a selectbox from a table click
Hello I’m trying to pass the data from a table pulled from the database to the fields that belong to update in the same page where you register but I can only pass the data of the textbox the page…
-
0
votes1
answer1439
views"PDO" class not found after upgrading from PHP 7.2.13 to PHP 7.3.0 in Debian 9
On a Debian 9 server, I upgraded PHP from version 7.2.13 to version 7.3.0, but now PDO no longer works. Fatal error: Uncaught Error: Class 'PDO' not found. The libs are already installed: root@/#…
-
0
votes2
answers47
views -
0
votes1
answer233
viewsProblem when creating a connection between PHP and Postgresql
I am unable to make the connection to the Postgresql database. Follows the code: <?php class Conexao { private $usuario; private $senha; private $banco; private $servidor; private $porta; private…
-
0
votes1
answer27
viewsrecovering array with PDO
I have a problem that I’ve been through before but I can’t remember how I solved it. The goal is to compare two tables of the database and return only the corresponding values between the two, in my…