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
answer69
viewsWhat is the best way to repeat the same query without copying and pasting?
I have a query and I will need to use it twice, once I will use the fetchCollum and another I will use the fetch(PDO::FETCH_ASSOC). That said, I can’t apply a fetch and then apply another fetch, for…
-
0
votes1
answer67
views"login" method error using php and Pdo object orientation
good afternoon, I am in error when logging into my restricted page... SCREAM: Error suppression ignored for ( ! ) Fatal error: Call to a member function logar() on a non-object in…
-
0
votes1
answer32
viewsAjax function with php is not working
I have this code plus ajax doesn’t even carry a value $.ajax({ url: 'php/vizCliente.class.php', type: 'POST', data: { update: '1' }, cache: false, datatype: "json", error: function(e) { alert('Erro…
-
0
votes1
answer505
viewsHow do I query passed by get in id Pdo to code
I’m starting in Pdo now, so will start the games for me a little bit and my question is the following: I am working on another code of a friend and in his code the get to display the information is…
-
0
votes1
answer301
viewsError while deleting with PHP using PDO class and object orientation
I’m making a delete on my form manut_usuario, below is my method to delete which is in class usuario.class.php; public function DelUsu($id){ try{ $delUsu = "DELETE FROM usuario WHERE idu_usujport =…
-
0
votes0
answers278
viewsPDO, Select a query with some fields, from a certain user and code
I need to set up a consultation where I’ll only have five fields (STATUS, ID_USUARIO, PACKED, ID_TRANSACAO and ENTREGUE). I need that when I have change of STATUS change to another table, and update…
-
0
votes1
answer137
viewsHow to update a different table with data from another table in PDO
I have a pay-as-you-go table, and in it I have an indemnification code for every transaction, when receiving the update data, I want to take the data and enter in update in another table of the…
-
0
votes0
answers181
viewsHow to Update 2 tables with Switch case and database data and others coming from an xml return?
I have progressed a lot in the code, within what I thought was necessary, only I don’t know how to organize my syntax so that everything happens as I want, the switch/case that runs in the bank to…
-
0
votes0
answers141
viewsProblem of slow consultation of PROCEDURE
There is in my system an email sending routine. Where a bat windows executes a php file that sends the same. The problem is in a stored Procedure, that executed directly by the bank, brings the…
-
0
votes1
answer46
viewsWhere is the error?
I’ve reviewed this query several times but I don’t find the error. "SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to…
-
0
votes1
answer230
viewsChanging data with PDO but does not update in the database
My form is like this: // pega o ID da URL $id = isset($_GET['id']) ? (int) $_GET['id'] : null; //Valida a variavel da URL if (empty($id)){ echo "ID para alteração não definido"; exit; } $sql_selecao…
-
0
votes0
answers180
viewsPHP PDO Drivers for SQL Server
It was with the same problem, I performed the steps indicated, however, I did not succeed in installing the SQL Server connection. Versions: PHP = 5.6.21; OS = Windows Server 2008 R2 Enterprise SP1.…
-
0
votes0
answers1660
views1452 Cannot add or update a Child Row: a Foreign key Constraint fails
SQL Query: INSERT INTO tributos_prod (codigo, ncm, Descricao, preco, quantidade, v_total, situacao_trib_icms, origem_trib_icms, aliquota_icms, credito_icms, situacao_trib_pis, valor_base_pis,…
-
0
votes2
answers293
viewsdisplay the user who is logging in PHP
I have a problem, that when the user logs in, correct, shows a div that displays the message "Welcome" ( and I would like you to show the username ) and it does not show, I would also like that if…
-
0
votes4
answers183
viewsPdostatement::rowCount returns -1
I need to know how many records were entered in the query below. public function CadastraCliente() { $this->conn->beginTransaction(); try { $stmt = $this->conn->prepare(" INSERT INTO…
-
0
votes0
answers662
views -
0
votes2
answers544
viewsOn-demand paging with PHP POST button and method using PDO
I looked at some sites and saw some things about it, but I’m not getting the logic behind the page on demand. jQuery(document).ready(function(){ jQuery('#btnpaginas').click(function(){ var dados =…
-
0
votes0
answers345
viewsGeneric crud with phpoo and Pdo (no framework)
I want to make a kind of Generic Crud and I implemented the function of Insert, I know that the way I did is not a better way to do it and I don’t want to use any kind of frameworks and so I would…
-
0
votes0
answers38
viewsIdea for data cleaning and processing library
I need to make a library for data processing, so I can use it before calling functions like: Register, Change, Delete and etc... I am using PDO for communication with the mysql database, and the…
-
0
votes2
answers199
viewsHow to show Options (HTML) with database elements
Hello, I want to do the following: I want the elements that are registered in the database to appear within a "Select - Option (FORM - HTML)". Ex: <body> <?php include("conexa.php"); $id =…
-
0
votes1
answer1783
views"SQLSTATE[HY093]: Invalid Parameter number: no Parameters Were bound"
I have a simple class that runs an Insert on a Mysql database as follows: $db = new db(); $db->exec2([0=>["Brasil","BRA","BR"]]); In the db class I have the following list of queries :…
-
0
votes1
answer62
viewsError inserting into MYSQL via PDO
I just started in the area and came across this situation. This my code is not inserting in my Mysql. <?php try{ $pdo = new PDO('mysql:host=localhost:3306;dbname=formularioecofin', 'SECRETO',…
pdoasked 7 years, 2 months ago Bruce Duarte 89 -
0
votes2
answers954
viewsPDO Insert Record
I’m in trouble to insert bank record with PDO, below follows the tabela and script: Calendar table CREATE TABLE `calendar` ( `id` int(11) NOT NULL, `title` varchar(255) CHARACTER SET latin1 COLLATE…
-
0
votes1
answer853
viewsField 'data_log' doesn’t have a default value - Does not insert data into the database
You are not only entering user data in the database, so I used the command: print_r($inserir->errorInfo()); And this mistake appeared: Array ( [0] => HY000 [1] => 1364 [2] => Field…
-
0
votes0
answers40
viewsNot recording information in the database
When informing customer data to be registered in the bank, simply does not record and does not present any error, I believe the error is here if($site->inserir('loja_clientes', $dados)) But just…
-
0
votes1
answer550
viewsProblems with PDO class not found
I am studying a book in which I have to make some queryes through a Pattern Tabledatagateway design but I am getting the following error message: Fatal error: Uncaught Error: Class 'classes tgd PDO'…
-
0
votes1
answer23
viewsI cannot display data populated in column-separated Divs
I want to display data from a table by Divs with columns of specific size for each of them, but when I load the information, it brings them all in the same column, I don’t want to use table tags to…
-
0
votes1
answer88
viewsHelp with unlink in PDO
I am trying to migrate MYSQL to PDO, and came across a problem with Unlink. With the code below I can do the UPDATE in the BD Banner table, and also store the new file in the destination folder…
-
0
votes1
answer1029
viewsDifficulties with PHP - lastInsertId()
I’m having trouble getting the last id inserted in my table using the php PDO function lastInsertId() How do I get the last id inserted in my table using my structure? Connection to the bank class…
-
0
votes1
answer326
viewsHelp with Ajax Combo Box
I used a video lesson from Youtube to create a Combo Box of States and Cities, but I followed the reasoning of the page ESTADOS.PHP and entered in the page CIDADES.PHP and created the page…
-
0
votes1
answer1721
viewsHow to resolve Fatal error: Call to Undefined Function Contausuario() in
In my case I have this function : in the Home archive at the very beginning imported here: <?php require_once("session.php"); require_once("class_usuario.php"); $auth_user = new USER(); $user_id…
-
0
votes0
answers91
viewsConversion to PDO
I would like your help to transform the following code to PHP PDO. I made the following conversions and commented on the front of the code, just to answer the question. It is if the conversion is…
-
0
votes1
answer662
viewsInsert with Foreign Key (user + address(FK)) PHP(PDO) + Mysql
Good afternoon, you guys. I have a small question: When registering a customer (with an address field (fk)) the correct way is something like this, or has a better way? INSERT INTO…
-
0
votes0
answers46
viewsPdostatement::execute(): SQLSTATE[HY093]: Invalid Parameter number: Parameter was not defined
I have a problem making an Insert in the base using PDO. PHP shows me this error. Searching, I saw that this error refers to the number of parameters that do not hit bindValues, for example: INSERT…
-
0
votes1
answer54
viewsHow to send more than one value by Return
I am performing a query in the bank and want to returns more than one query value as I do it? The structure of my table and the following Id_idx | name | OUTROS | Each Id_idx can be repeated up to 3…
-
0
votes1
answer67
viewsHelp with asynchronous request script
This form will have the purpose of scheduling for consultation, with the client selecting the desired professional, and having a calendar with the weekly days selectable for service. For example: Dr…
-
0
votes1
answer78
viewsContinuation of Help with asynchronous request script
I solved with the help of Marcos Brinner, the problem with Detepicker according to previous post. But he painted another doubt regarding asynchronous request, between the Detepicker (Calendar) and…
-
0
votes2
answers595
viewsList BD data using echo (PDO)
Hello, I have this code: <<?php include("conexao.php"); $pdo = conectar(); $buscarusuario = $pdo->prepare("SELECT * FROM tab_clientes WHERE ID=:id");…
-
0
votes1
answer902
viewsEmail No Localhost or Mail Server()
Hello, I have the system PHP below to register after the user’s Ubmit, the registration usually occurs, however I would like to be sent an email to the registered email, but the way I did is not…
-
0
votes0
answers30
viewsPDO Insert only runs once
I’m studying PDO to be able to redo the functions of a crud that I use in mysqli, but I have a problem, when I do an Insert with this function the first time it inserts the value in the database,…
-
0
votes0
answers54
viewsHow do I turn mysql into Pdo?
I have this Function in mysql. public function get_logst(){ $this->connect_database(DAT5); $querygetl = mysql_query("select HeroName, ObjIdx from ObjLog where LogType = '5' and LogSubType = '2'…
-
0
votes0
answers71
viewsHow do sum with php or SQL?
Hello I want to add the total values of the result of a PDO query. However, when executing the command the following message appears in the console: Object of class Pdostatement could not be…
-
0
votes0
answers32
viewsget_where to PDO
I want to change get_where to mysql or PDO, but I don’t know! Help ...! public function get_where($table = '', $where = NULL, $limit = NULL, $offset = NULL) { if ($table !== '') {…
-
0
votes1
answer75
viewsDisplay only members with a status in a <select> with php Pdo
What I’m trying to do is select all members of the member table that have the Lider name in the "member" column display in select sorted by name. <div class="form-group"> <label…
-
0
votes1
answer115
viewsRegister selected checkbox values with php and Pdo
I’m not being able to include the selected courses also would like to know how to register them separated by a "-" <div class="form-group"> <label for="checkbox" class="col-sm-3…
-
0
votes1
answer229
viewsPresence list php and Pdo
What I’m trying to do is that all people connected to the logged-in user in session appear with a checkbox so that I can put whether he was present or not and is not appearing there for me to put…
-
0
votes1
answer51
viewsSearch in Mysql using day, month or year only with PHP
I created a table, in it a field in the format DATETIME to store the day, month, year and time in which a record is made. I wonder how I can do to search only using day, month or year ? Example: I…
-
0
votes0
answers67
viewsRegistration using PDO, error 22527?
I have this PHP code below that will be executed after the form Submit to register in the database. If you go through validation, a new user will be created and hashed and then entered into the…
-
0
votes1
answer56
viewsHow to generate query and add new input?
I have a field input of the kind date I want every time I click and view it generates a select with the date query I have set and generate a new input to add another date and so on. My code so far:…
-
0
votes1
answer101
viewsPHP and Mysql Division without rest in PHP task division
Galley is the following need to assign tasks to a variable number of participants. EX: Through a select I got 49 tasks to be executed and I have to distribute to 4 employees. In other words the…