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
votes0
answers56
viewsPDO mysql and PHP error
I already 'decoded' the php.ini file for the PDO to work, restarted several times apache, mysql, notebook, but I can’t connect to Mysql database. Use Windows 7. Worst I installed a virtual machine…
-
0
votes1
answer329
viewsCan I do more than 1 Insert using PDO?
I want to do more than 1 Insert using PDO and a php file, can I? Example: <?php ini_set('display_errors', true); error_reporting(E_ALL); header('Access-Control-Allow-Origin: *');…
-
0
votes0
answers19
viewsJoin multiple PDO BINDPARAM checkboxes
I have a long form beyond the normal data, name, Evil and so on, I have 129 checkboxs, with a script that limits the choice of 3 checkboxs, and I want the 3 checkboxs chosen, are all inserted in the…
-
0
votes1
answer94
viewsProblems deleting data from table with ::PDO
Can anyone explain to me what the error or if there is a flaw in the script?? As far as I know this is correct, but it doesn’t work. In the script it takes the ID of who followed and the ID of who…
-
0
votes1
answer55
viewsDouble entry in the database?
I’ve been through my code and I can’t find the reason he’s adding two records to the database. Function: public static function create($table, array $params) { $key = array_keys($params); $value =…
-
0
votes1
answer76
viewsHow to make 1 query and distribute the result spread by the code?
Well I have a site where I am to each area using a select , I think I’m making more queries than I should, is there any way to repeat the result ? follows a picture of what I am proposing <?php…
-
0
votes0
answers857
viewsPDO + DAO, am I doing this right?
I started to take a look at PDO and DAO but still do not understand how to do right. I had some problems with the function bindParam that does not pass get method then I had to do a gambit. And also…
-
0
votes2
answers11884
viewsAdd value of an array
I need to sum up the values provided by an array. The array comes from a select in the database. The array is this way: Array ( [0] => Array ( [valorPagamento] => 12 ) [1] => Array (…
-
0
votes1
answer96
viewsProblems search php Pdo
I’m making a field to search but returns me some errors. My code: class Prog{ private $DtBase; public function setdata($DtBase){ $this->data = $DtBase; } public function getdata(){ return…
-
0
votes1
answer62
views -
0
votes0
answers283
viewsHow to get file from inside the database?
I’m using postgresql as sgdb, and I’m saving files. txt in bd, so far, all right, it’s working right, but I’m not finding a way to get the content of the txt files saved in bd, I’m using php with…
-
0
votes1
answer64
viewsOmit beginTransaction commit PDO MYSQL
What happens in practice when I omit the begin transaction and the commit in a PHP script using PDO? I have a loading script, which processes school data, every school that finishes processing I do…
-
0
votes1
answer355
viewsPdostatement::bindParam() mix data
I have a class that inserts the records into a table. The data coming from the request I turn it into an array and then build an SQL statement similar to that: INSERT INTO web_messages…
-
0
votes1
answer596
viewsPick up information from one foreach with another foreach
I have a mysql search that brings me the following array when using a foreach, I have another sql search that brings me all the fields of a table that in case are the same field names that are below…
-
0
votes2
answers457
views -
0
votes1
answer288
viewsBETWEEN with DATETIME field
Using the BETWEEN with DATETIME database fields the same does not return the records with date equal to datai and dataf. Using DATE_FORMAT to search for date by bypassing TIME Considering the search…
-
0
votes1
answer49
viewsRetrieve a general rating and display in a list
Good evening guys, I’m in the following situation, I have a table called cars, and each car can be evaluated by different users, so far so good, I created a secondary table called reviews and each…
-
0
votes0
answers68
viewscrypt for javascript
Well I’m working on a project that I need to use the crypt as a method to encrypt the password, but this password I need to use in mobile, how do I use something that the crypt will understand and…
-
0
votes1
answer27
viewsProblems when instantiating the object
public function select($sql, $array = array()) { $sth = $this->conn->prepare($sql); if(!empty($array)){ foreach ($array as $key => $value) { $sth->bindValue(":".$key, $value); } }…
-
0
votes0
answers178
viewsGrab table id generated by setFetchMode(PDO::FETCH_ASSOC)
Good afternoon friends, I am trying to generate a link sending a parameter that would be the row id of the table clicked <a href="page?id=echo'.rows['id'].'">Editar</a> this code works…
-
0
votes1
answer298
viewsData in JSON format is not shown
Hello, I have the following php code: <?php require("config_local.php"); //conexao com o banco de dados $area = "eua"; $st = "ny"; $sql = $pdo->prepare("SELECT…
-
0
votes0
answers88
viewsFatal error & Pdoexception in SELECT POO PDO
I am trying to perform a select, but I receive the following messages concerning the same line: Fatal error: in C:\wamp\www\curso\Crud.class.php on line 24 PDOException: in…
-
0
votes1
answer236
viewsHow to see the amount of results with PDO
Good night, As use, I do to count the amount of results of a select in the database using PDO? <?php ini_set('display_errors', true); error_reporting(E_ALL); header('Access-Control-Allow-Origin:…
-
0
votes0
answers64
viewserror - SQLSTATE[23000]: Integrity Constraint Violation: 1062 Duplicata du Champ '0' pour la clef 'PRIMARY'
I am working on my tcc in which I create a database of suppliers for a drug company. Summarizing my problem, at the time of sending the data to my database this giving the error message…
-
0
votes0
answers58
viewsError in php search system
I’m making a search system, only it’s giving an error, I’d like to know the solution. Follows the code: <?php require_once 'conect.php'; if(isset($_POST['submit'])){ $nome = $_POST['nome']; $pdo…
-
0
votes1
answer241
viewsInsert with SQLSTATE error [HY093]
I am making a form to save data in the database and this error Erro SQLSTATE [HY093] <?PHP $nome = $_REQUEST['Nome']; $cpf = $_REQUEST['CPF']; $sexo = $_REQUEST['Sexo']; $datanasc =…
-
0
votes1
answer54
viewsA problem with variables in JS and PHP
I’m building a book registration system, it’s quite easy actually, it only involves a little bit of PHP and Mysql, but my problem is time to display. See, it’s a lot of information, so I wanted to…
-
0
votes2
answers207
viewsError when instantiating two or more PDO in different classes
I will start with the error displayed: Fatal error: Uncaught Pdoexception: You cannot serialize or unserialize PDO instances in [no active file] on line 0 In the project I have the class Carts and…
-
0
votes0
answers228
viewsLogin User PHP
I’m making the following code PHP public function Login($uname,$umail,$upass) { try { $stmt = $this->conn->prepare("SELECT usersid, user, email, password FROM user WHERE user=:uname OR…
-
0
votes0
answers40
viewsError inserting Multiple PHP + PDO + POSTGRESQL Lines
I am using Multiple Insert, but the internal characters of the text have caused Insert to fail. I used the addslaches method in the string but the error remains, some hint of what I can do to…
-
0
votes0
answers39
viewsHow do I print the semesters on canvas
I have this code, the query is already done, just call on the tag. How do I print on canvas the months of the semester after the goals. <?php /* codigo para gerar os paramentros */ $ano =…
-
0
votes1
answer7376
viewsHow to check "SQLSTATE[42S22] error: Column not found: 1054 Unknown column"
I wonder how I can verify this error in my code "SQLSTATE[42S22]: Column not found: 1054 Unknown column" private $untamed; public function RetornaIndoperacionais($ano){ if($ano == '2016'){ $_base =…
-
0
votes0
answers305
viewsMysql SUM function and return data
The function below does not return me the expected. I want her to return a sum and the fields with the id colaboador , but in Javascript I get an error, and I believe it is in PHP. select works…
-
0
votes2
answers228
viewsPHP - Return column sum at date specifies // PDO
How to make that in return fetch(PDO::FETCH_ASSOC) he adds the columns p_line_a (height) and p_line_l (width) referring to a specific date. For example: A person who sees the sum of the integers of…
-
0
votes1
answer69
viewsHow do I get PDO to list Array with Correct Types?
In Mysql save data to a table by setting some fields as int or float, but when I make a select in the database via PDO array Everything comes as a string. Has some function that forces you to return…
-
0
votes1
answer325
viewsWrite JS to database with $_POST
Hello. I have a PHP script that runs an INSERT in a table of my database. The $_POST[txt_message] array shown in the code should accept JS content, but it is empty after Submit. He should accept for…
-
0
votes1
answer187
viewsHow to query Pdo by date using input Month?
I would like to know how I can make an appointment for the month chosen along with the name. Like if I choose August it will only come month of August and so on and so forth. This is the query…
-
0
votes0
answers23
viewsPHP PDO, what is the practical difference in parameter sending?
I’m having a question using the pdo in the php, there is some practical difference in implementation using these two approaches? $db = new PDO("ok"); $sql = "INSERT INTO tabela (campo1, campo2)…
-
0
votes1
answer287
viewsStructure Array coming from mysql with PDO (organize)
Good evening, I’m having a hard time with arrays where I’d like them to stay in order so I can use them as follows. In my database I have many images that I call them with this code below. <?php…
-
0
votes1
answer91
viewsMysql transaction error in php
Good morning, forum guys. I’m trying to do the simultaneous Insert, then I’m using transaction control in php, only it doesn’t make the first Insert, so it generates me a Foreign key error. public…
-
0
votes0
answers39
viewsSee table by date
Guys, I have a table that the data is recorded as follows: ID CANAL VALOR DATA 25 10 50 2016-10-14 14:10:05 26 11 12 2016-10-14 14:10:06 27 10 51 2016-10-14 15:10:10 Both records are recorded…
-
0
votes1
answer85
viewsValidation php Pdo function
I have the function below that makes an Insert in table ESP35302_TMP but before inserting I need to do a validation in this table, if there is already the number of barcode I am inserting, if there…
-
0
votes1
answer911
viewsPDO SQLSTATE[07002]:COUNT field incorrect or syntax error
I’m having trouble making a decrease in sql with Pdo. I’m getting the following error SQLSTATE[07002]: [Microsoft][ODBC Driver 11 for SQL Server]COUNT field incorrect or syntax error code <?php…
-
0
votes0
answers49
viewsHow to search a single field of 3 tables with JOIN using Respect Relational?
I’m starting to use the framework Respect\Relational and I was just trying to get the names of the chart templates that belong to the id 1 business line, but all the forms I tried always returns all…
-
0
votes1
answer65
viewsAuthentication problem in PHP, returns PDO::errorcode(): 00000
I have a problem to authenticate a site with php, when I put the data in the form it returns the error message I enter if it failed and another error message 0000 in the login method. Apparently I…
-
0
votes1
answer160
viewsProblems with encoding SQL Server 2008
I am performing a query in an Sql Server database, but the special characters are returned as follows: MAR�O instead of MARÇO I was able to fix using the function utf8_encode(), but I do not want to…
-
0
votes1
answer45
viewsPDO help using Mysql
I’m having trouble connecting the database using PDO, use Mysql. when executing the connection with the bank appear the following error messages: Fatal error: Uncaught Exception 'Pdoexception' with…
-
0
votes2
answers895
viewsPHP PDO Notify user which registration name already exists
Hello. The code below does not allow the user to choose an already used name. But I would still like to warn the user who chose the wrong name so he knows he needs to choose another registration…
-
0
votes1
answer57
viewsHow to pass the value of a "$variable" coming from another page, and use it in a select PDO
Next, first I would like to know if it is possible to receive from another page, through a session_start(), value of a variable and apply it in a select. I’m doing it this way: At the beginning of…
-
0
votes0
answers137
viewsHow to check if it has not already been inserted, in PDO?
I need to check if it has already been registered before entering it in the database, as you can see, I get an array of software and I need to validate all of them before inserting. Basically it…