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
answer920
viewsHow to return all results from the [PDO] database?
I’m doing a function to return all the results of a database. The function in this exact format returns me only one result but putting echo in each statement returns me all the results. How can I…
-
1
votes1
answer586
viewscommit/rollback in two tables with PDO
First of all, the code below works, there is no error (but possibly can be improved). I have the following method in PHP: <?php public function ajustarUnidadeServidor($ajusteExercicio){ try {…
-
1
votes1
answer364
viewsEnable Firebird PDO support for PHP
I cannot install Firebird PDO support in PHP. My machine is running Mac Os Sierra. I have already researched on Pmorts and Pmmebrew and they do not offer support. Some old posts do not explain in…
-
1
votes0
answers506
viewsSave image together with form to database by PHP
Good afternoon guys, help me please, I found a tutorial on the internet that teaches you to save the image in the database with php and jquery, but it teaches send only the image I’ve tried every…
-
1
votes2
answers462
viewsSearch without returning PDO data
My variable is being passed but the filter process is always not returning anything. try { $keyword = trim($_GET["keyword"]); if (!empty($keyword)) { $sql = "SELECT * FROM noticias WHERE titulo LIKE…
-
1
votes3
answers925
viewsSearch name by first and last name
I’m having a hard time designing a query Mysql to search for a name, and the person can type the first and last name and accept to have another name between them. For example: Search: 'JOSÉ NUNES'…
-
1
votes1
answer91
viewsWhy is there no result in PDO fetch Collum?
I made a query and want to use fetch Collum according to a reply from the other site; $query = $pdo->prepare("SELECT b.**, b.**, b.**, b.**, b.**, b.**, b.**, b.**, b.**, b.**, b.token FROM…
-
1
votes1
answer441
viewsAbstraction of the PHP PDO Connection class
Staff I have the following class for database connection... namespace App\Database; class Conn { public static function getDb() { return new \PDO('mysql:host=localhost;dbname=dkse','root','root'); }…
-
1
votes0
answers39
viewsProblems adding fetchAll results to an array
private $resultado; public function buscaTodos($query){ $stmt = $this->conn->prepare($query); $stmt->execute(); $this->resultado = $stmt->fetchAll(PDO::FETCH_OBJ); } public function…
-
1
votes1
answer57
viewsDoubt about PDO connection
And everybody, I have a question about the PDO connection. This is the connection I have in the script that I’m configuring: <?php function getDB() { $dbHost = 'host'; $db = 'bd'; $dbUser =…
-
1
votes3
answers76
viewsHow to do sub-consultation with Pdo
I would like to perform a sub-query within that query: $ranking = $pdo->query("SELECT * FROM usuarios_emblemas GROUP BY usuario ORDER BY count(usuario) DESC LIMIT 3"); It would be to block the…
-
1
votes1
answer1192
viewsHow to select a column name in Mysql?
How to take the name of a column in Mysql even if it has no lines?
-
1
votes1
answer23
viewsInsert function is not working
I have the following class in php: <?php class contaEntrada { public $mostraDados; public $insereDados; function conectar(){ $host = "localhost"; $user = "root"; $pass = "root"; $dbname =…
-
1
votes2
answers70
viewsHow to insert the connection inside the functions without repeating the instructions?
Since I have several functions that will use this connection, how to enter the $pdo within the function without copying the require and $pdo within each of the functions that I will draw up?…
-
1
votes0
answers249
viewsHow best to store an array in a single field in the database
Is usually used implode/explode or serialize/unserialize to store multiple information of a particular item in the database. Using PDO, which would be the best and whether there is another way to…
-
1
votes2
answers851
viewsDatabase connection - PDO
Guys, in the course, we are manipulating database with PDO, but now in the connection part, appeared to me the MYSQL_ATTR_INIT_COMMAND and I don’t really understand what it’s for, I just know that…
-
1
votes3
answers223
viewsPDO Pagination - Fatal error: Out of memory
I am making a pagination, but it is generating a memory error. Is there any way to optimize or fix the fault? Or is it on the same server? Note: the php.ini this set the memory in 512. if…
-
1
votes0
answers59
viewsSqlite PHP Injection
Hey there, guys! I am currently using sqlite in a personal project and am using this class: https://github.com/TimOliver/PHP-Framework-Classes/blob/master/db.sqlite.class.php When I use its query…
-
1
votes1
answer448
viewsApplication of the Singleton standard for small/large design
I’m building classes for an old project where I used only functions in different files. The goal is clear, to create a reusable code standard for small-scale projects with not very distinct…
-
1
votes0
answers30
viewsProtect content from php files?
I don’t know if I’m doing it right, but I have a file called Setting.php in my project, but I’m not sure that it is protected because it contains the login information of the Cpanel admin, so if…
-
1
votes0
answers862
viewsCreating multidimensional array from query to BD Mysql
I have the following problem: I have a table in a Mysql database and in a code snippet I need to make the content recovered by a query made to this database be stored in a multidimensional…
-
1
votes1
answer284
viewsBETWEEN with Inner Join does not work
I am having a problem when making a query using between with Internet, the query is simply not working, it returns the results as if the between was not in the query. What I’m doing wrong? SELECT *…
-
1
votes2
answers69
viewsList all data from a survey
How to list all the data of this query, I can only show the first line but I want to query all and show them. public function gerarCardapio(){ try{ $cat = "M"; $sql = "SELECT * FROM alimentos WHERE…
-
1
votes3
answers465
viewsColumn 'Activocirculation total' cannot be null
I’m finding it very strange what’s happening because yesterday worked perfectly! I created the following code: require_once 'credenciais.php'; //pega dados do formulário de ativo e passivo…
-
1
votes1
answer1527
viewsWarning: array_keys() expects Parameter 1 to be array, null Given in
How do I fix it ? Warning: array_keys() expects Parameter 1 to be array, null Given in C: Program Files Vertrigoserv www store classes Site.class.php on line 81 Warning: array_values() expects…
-
1
votes1
answer160
viewsCan’t I return all the input data with PDO?
I created a page to put the cpf and soon after doing a database search, and brings the data according to the typed Cpf. but has some inputs that are not coming back as <radio> (sex M or F),…
-
1
votes2
answers892
viewsPDO - Which is better: columnCount or rowCount?
I’m new to PDO (I was forced to choose between mysqli and Pdo after migrating php from version 5.2 to 7.0) and made a system where the user does the search: $b2 = $_POST['b2']; $busca =…
-
1
votes0
answers31
viewsFrequency System | Convert to PDO or MYSQLI
Do you have how to convert these mysql codes to PDO or MYSQLI, Please Help Me :( <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"…
-
1
votes0
answers1487
viewsPDO - Uncaught Exception 'Pdoexception' with message 'could not find driver'
Look at us! I am trying to set up a project in a Mac Yosemite environment. The project I intend to run works normally on an Ubuntu. I did the installation of the PDO drive. phpinfo is like this: PDO…
-
1
votes1
answer46
viewsPDO does not return Count
I need to store the result count, but apparently with PDO I can’t store the value. I’ve already select on the outside and the result comes, because I can’t store in the variable $flag the result?…
-
1
votes1
answer414
viewsSql Injection in Stored Procedures
It is possible to carry out injection of SQL in Stored Procedures, especially when calling a Procedure for PDO of PHP? DELIMITER // CREATE PROCEDURE procedureTeste( string VARCHAR(255) ) BEGIN…
-
1
votes1
answer29
viewsHow to insert data into related tables using PDO
I researched a lot more I found nothing concrete with PDO, hear about this function last_insert_id but I have no idea how to apply.
-
1
votes1
answer1047
viewsInsert Data into PHP PDO database
Good evening, I would like a help in my code. I am trying to enter some data, coming from a form, in the database. Follow code: insert Register.php session_start(); include_once("settings.php");…
-
1
votes3
answers229
viewsDisplay the result of a COUNT in the Database
The PHP code looks like this: $con = new PDO(SERVIDOR, USUARIO, SENHA); $sql = $con->prepare("SELECT COUNT(id) FROM quiz;"); $sql->execute(); $n = $sql->fetchObject(); And the HTML code…
-
1
votes1
answer3743
viewsLogin using PDO
I’m developing a system of login with the pdo for learning, but it always accuses error in password. Follows the code: <?php session_start(); include "../../lib/inc_con.php"; $pdo=conectar();…
-
1
votes0
answers49
viewsPass variable into the IN
I’m having a hard time passing a variable into the IN in Mysql - PHP - PDO. The URL looks like this: /PESO=50&IDADE=18,20 Code: $read->FullRead("SELECT DISTINCT NOME FROM pessoas WHERE PESO…
-
1
votes1
answer53
viewsHow do I resolve the prepare error for this script?
I’ve been looking for a solution for 2 hours [this problem][1]. I am starting a course of Virtual store with PHP and the mistake is this: he says I’m trying to give a prepare in an unincorporated…
-
1
votes1
answer396
viewsselect with Pdo in functions
How do I use my select in mine funções.php in this table that is in my estoque.php , I’ve done the script just can’t call the $resultado that this in the function to use in the foreach. STOCK.PHP…
-
1
votes1
answer553
views -
1
votes1
answer73
viewsProdutos Relacionados
Good afternoon. How do I make the chosen product not appear in the related products? $stmtProdRel = $pdo->prepare("SELECT * FROM produtos as p WHERE p.produtos_situacao = 1 AND…
-
1
votes0
answers7
viewsProblems updating to MAMP
I have a problem that after I updated MAMP to version 5.7.25 of mysql , when trying to insert a record it simply asks in the correct type, example: I have an ID field where it is integer and…
-
1
votes0
answers67
viewsPHP PDO Display a single record
Hello. I have a popup system where the client chooses which one will appear on the home. If one is already selected he cannot select another. You have to uncheck the asset and mark what it wants. I…
-
1
votes0
answers384
viewsSearch for Zip Code Band
Good afternoon, I need to get a zip code from the zip line registered in the bank... **banco de dados:** cep_id | cidade | cep_de | cep_ate 1 | jau | 10000000 | 15000000 $cep = "15086210"; $stmt =…
-
1
votes1
answer477
viewsData php Pdo format
Input: <html> <form action="../controller/progPrecontrole.php" method="POST" onsubmit="return valid();"> <input type="hidden" name="id" value="<?php echo $id; ?>"/>…
-
1
votes1
answer128
viewsPass GET parameter through AJAX to activate page
I need to make the redirect after doing some commands in php need to load an ajax. The link that sends to PHP page:…
-
1
votes1
answer33
viewsPDO(prepare) analyzes number of characters?
My question is simple: Imagine I have a table Nome and in it an attribute nome which is a varchar(10). If I use the command $preparado = $con->prepare("INSERT INTO Nome(nome)…
-
1
votes0
answers23
viewsFilter_input and PDO
1 - Which filter would be most useful in a string that will then be placed in a BD. 2 - Is there a page that shows what each filter is about and what its main uses are? Because I only found the page…
-
1
votes1
answer666
viewsHow to reduce the INSERT script in the BD with PDO -> bindValue?
Some way to shorten that script?? Or every time I go INSERT in the data set using PDO and the function bindValue, will I have to write line by line?? Or da para utilizar um array ou algo fácil e…
-
1
votes2
answers137
viewsError while saving data using PDO
I’m having a problem entering data in the database using PDO and do not know the reason, in my view everything seems to be right, follow below the codes. Model class class User { private $id;…
-
1
votes2
answers111
viewsINSERT duplicate with mysql ::PDO
Can anyone explain why when I run this code it INSERTS twice the same value in the table? I believe it is that this problem happens when I do a validation to check if the values were entered:…