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
answers318
viewsHow to remove Parse error: syntax error, Unexpected 'public'
Hello I would like to know how to get this error out of my query <?php public function RetornaAtualizacoes(){ if($_SERVER['REQUEST_METHOD'] == 'POST') { try { $Query = "SELECT s.setor, s.usuario,…
-
0
votes1
answer9732
viewsHow to Remove Fatal error: Uncaught Error: Class
Hello I am creating a system of envy and is always giving this mistake ,Fatal error: Uncaught Error: Class 'cRelatorios' not found in C:\xampp\htdocs\Projetos\relatorios.php:170 Stack trace: #0…
-
0
votes1
answer1623
viewsError using PDO: "Call to a Member Function query() on a non-object in ..."
I am trying to make a query in the bank, but I get the following error: Fatal error: Call to a Member Function query() on a non-object in C: wamp www site-noticias Class Publicacao.class.php on line…
-
0
votes1
answer77
viewsIt is unusual to have a class called mysqli the getInstance() method return the Fatal error: Uncaught Error: Call to Undefined
Hello I’m making a system to search list the data in the database for the month only it give the following error Fatal error: Uncaught Error: Call to Undefined method mysqli::getInstance() and in my…
-
0
votes0
answers654
viewsUncaught Exception 'Pdoexception' with message 'SQLSTATE[23000]: Integrity Constraint Violation: 1048
I am trying to make a simple entry in the database, as I have done several times, using PDO and I can’t! What’s wrong? PHP: <?php include_once("con.php"); $pdo = conectar(); $data =…
-
0
votes2
answers497
viewsRecording data from a SESSION in the BD
I would like to add in the field registered the functionname logged in to database. <?php require_once("../../../session.php"); require_once("../../../class.user.php"); $auth_user = new USER();…
-
0
votes2
answers168
viewsData is not being written to the BD by PHP
I’m studying PHP object oriented and, from some tutorials taken from the net (Pdo, pojo, Dao...), I made a very simple system in which I get the value inserted in <input type="text"> and write…
-
0
votes1
answer168
viewsMysql PDO function for json
I’m taking the first steps in MySQL PDO and I have 2 doubts in my code. A first related to the efficiency of the functions. The second doubt is related to the return of results of a database to…
-
0
votes2
answers193
viewsHow to take the value of POST and save to the bank
Good afternoon friends, I’m not able to save the second INSERT in the bank, because when I save, it goes as array, how can I solve this problem? Image of the View: Picture of the Bank Code…
-
0
votes0
answers30
viewsWarning: Pdostatement::execute(): SQLSTATE[HY093]: Invalid Parameter number: Parameter was not defined in
I know what the error is. It says that the number of parameters is not equal to the number of variables. I just can’t find where the error is. If anyone can see something I didn’t see, I’m grateful…
-
0
votes1
answer102
viewsError to grab last ID
Hi. I’m having trouble getting the last registered ID. I’ve made a lot of attempts, but the $proximo_ID variable always returns me '0', or Empty. You could help me solve the problem?…
-
0
votes1
answer77
viewsHow to update the PDO database after running a Javascript (Countdown) function
I’m making a Countdown Javascript, and would like when the count was == 0, execute a update in the database where would add a value <script type="text/javascript"> var count=new Number(); var…
-
0
votes0
answers22
viewsTriger after update as a solution to debit credits safely
I need to make an interface that guarantees the integrity of the customer’s credit. In PHP, when we use LOCK explicitly in PDO, with LOCK TABLES, when dealing there may be inconsistency, when the…
-
0
votes1
answer277
viewsRemove Mysql registry with PHP
I have a PHP page with Mysql connection. Everything works perfectly, however I have a DELETE button, which when clicking on it, takes the ID of that entry, goes to a page del.php and should remove…
-
0
votes0
answers43
viewsProblem with Notices, Object PDO
I have my class: public function SQL($sql, $arrayParams = null, $fetchAll = TRUE) { try { // Passa a instrução para o PDO $stm = $this->pdo->prepare($sql); // Verifica se existem condições…
-
0
votes2
answers374
viewsError inserting an image into Oracle using PHP PDO
I’m making a system in PDO PHP that records some images in the database, that same system was migrated from a database MySQL and it was working perfectly, but at the time I’m going to record the…
-
0
votes1
answer3372
viewsError Call to a Member Function prepare
The connection to the bank is working perfectly, but the getList method returns me this error: Fatal error: Uncaught Error: Call to a member function prepare() on null in…
-
0
votes0
answers96
viewsRegistration problem using PDO
I am creating a simple PDO registration system (I am beginner in this), and, I am not having success in designing my connection string and adjusting INSERT to add data to the database. Gives the…
-
0
votes0
answers48
viewsCall to a Member Function prepare() on a non-object in /var/www/studies/studyCRUD/classes/client.php l on line 24
object try { $conexao = new PDO("mysql:host=localhost;dbname=estudos", "root", ""); }catch(PDOExeption $e) { die ("não foi possovem conectar " . $e->getCode() . ": " . $e->getMessage()); }…
-
0
votes0
answers53
viewsID error Category/Subcategory
Banco da Categoria https://uploaddeimagens.com.br/images/000/857/341/original/3.png?1489170048 Bank of the Sub-category https://uploaddeimagens.com.br/images/000/857/342/full/4.png?1489170053 You…
-
0
votes0
answers216
viewsPDO class not found in namespace other than global
I’m creating a class that uses PDO, but in a different namespace than global: namespace Classes\Config; use \PDO; class Connection { public static function getConnection() { $dbhost = "algumhost";…
-
0
votes1
answer242
viewsQuery with array returning only first record
I have the following querys: <?php $VarMensagem = 1; $pdo = new PDO($dsn, $un, $pwd, $opt); $data = array(); $dataGeral = array(); try { $stmt = $pdo->query("SELECT * FROM mensagem WHERE…
-
0
votes0
answers32
views -
0
votes1
answer304
viewsPDO inserting null
I’m trying to create a simple screen of user registration, but I’m having problems performing the insert. The method is executed but the MySQL inserts null instead of form fields I get through a…
-
0
votes1
answer151
viewsAfter registration (in PDO), direct the page to index.html
I’m using HTML and PHP. The connection to the database works, it registers the entered data and everything. Next, I open index.html, it has the option that leads me to the registration page:…
-
0
votes1
answer343
viewsEntering data in PHP
Speak guys, I have a doubt that is the following, I am not able to insert data in PHP, give a help pfv :) ! Here is the code: This is my.class.php Connection <?php class Conexao { private $host =…
-
0
votes0
answers96
viewsPDO execute() with connections does not work
PHP version: 5.6 Framework: Slim Search Engine to bd: PDO I have the following database search: $cIndus = array("ex1", "ex2"); $query = "SELECT `nome_agr_corr` AS `brita`, CASE WHEN ? = 'usd' AND ?…
-
0
votes1
answer55
viewsData search problems by name, returns nothing
I’m having trouble searching for data by name. Following is the code. From now on, thank you. <?php include_once 'dbconfig.php'; ?> <?php include_once 'header3.php'; ?> <div…
-
0
votes1
answer254
viewsPHP PDO does not insert value
I don’t really understand PHP, but I’m trying to create a PDO connection. Connection works fine, but does not insert values... follows the code: config define("DB_HOST", "localhost");…
-
0
votes1
answer526
viewsPHP PDO - Mysql query data does not appear in table
What I’m doing wrong in this script? I make a query in the database to return all table data curso and show their names in the table, but it’s not working. Also this part of the code is being shown…
-
0
votes2
answers739
viewsCheck if the user is active in the database
I need to make a query if the user is active. Ex. I client log in to the panel, if my status is disabled, shows me a message, if my status is active log in to the page. follows my code <?php //…
-
0
votes1
answer48
viewsProblems with PHP function - PDO
Fatal error: Call to a member function prepare() on a non-object in C:\xampp\htdocs\trofeugs2017\model\Model.php on line 81 How to correct the error? Code: <?php class Model { protected…
-
0
votes0
answers478
viewsDoubt: Connection and query with PHP, PDO and MYSQL
Good afternoon! I have a mistake I can’t identify at all. I need to perform more than one query in different classes on a screen. My problem is happening when the second query is run Php is…
-
0
votes2
answers82
viewsJoin a lot of selects into one
I have 4 selects to do that I later put in the separate combobox only I want to put everything in one has like? $sqlq = $pdo->prepare("SELECT * FROM tbl_tipo ORDER BY tipo ASC"); $sqlq…
-
0
votes2
answers514
viewsDelete image from BD and Folder
I’m trying to create a script that excludes the image of the database and folder, but the problem is that it is only excluding from the BD and not from the folder. Tabela equipes id, nome, foto Here…
-
0
votes0
answers1850
viewsFatal error: Call to a Member Function rowCount() on Boolean
Hello, I’m a beginner in PDO connections in PHP and my first select I am facing the following error: Fatal error: Call to a member function rowCount() on boolean in…
-
0
votes1
answer61
viewsPage does not load for cause and transaction
I am trying to implement a transaction on my Sqls, but because of them, my page does not load. Follow the code: <?php //CONEXÃO COM O BANCO DE DADOS include_once("conexao.php"); //VARIÁVEIS COM…
-
0
votes1
answer1165
viewsDraw system
I am intending to make a draw system on my website. I read some questions (including one that I liked very much that was this one) and I noticed people saying that X Cities could never be drawn,…
-
0
votes1
answer292
viewsUse of Lastinsertid() more than once
I need to use lastInsertId() more than once in my application. Follow an example of such an event: <?php //CONEXÃO COM O BANCO DE DADOS $pdo=new…
-
0
votes1
answer154
viewsInsert class in PHP does not work and shows no error
I got the following code in php: <?php class Users extends DB { private function verifyUser($email) { $select = self::conn()->prepare("SELECT * FROM `users` WHERE email = '{$email}'");…
-
0
votes1
answer88
viewsUndefined Variable using this
I’m creating a basic class for database operations, but apache gives me two errors on line 12. Because the connection is an attribute I refer to the this. Why at the first reference when connecting…
-
0
votes1
answer1145
viewsFatal error: Call to a Member Function prepare() on a non-object
I am creating a class to perform querys in the bank, but am having the following error when I have use Prepared statements: Fatal error: Call to a Member Function prepare() on a non-object in C:…
-
0
votes1
answer89
viewsrowCount does not return zero
I have this script: <?php include 'config.php'; if(isset($_POST)){ $user = isset($_POST['user']) ? strip_tags($_POST['user']) : 'HabboColorFS'; $rank = $pdo->query("SELECT * FROM…
-
0
votes1
answer30
viewsI cannot use a query method when using a connection class
My kind of connection: class Connection{ private $host="localhost"; private $user="root"; private $password=""; private $dbname="test"; private function conectionDB(){ $conn = new…
-
0
votes0
answers28
viewsPHP Language Comparison
I need to compare products in the table if the language esp and ing are filled... When I register the product it registers as the language 1(by). Then the customer has to register the 2(ing) and…
-
0
votes1
answer160
viewsKnow the position on a listing
I’m wearing this query to know a user’s feedback quantity: $comentarios = $pdo->query("SELECT * FROM topicos_comentarios WHERE autor='".$ver['autor']."'")->rowCount(); However, I would like to…
-
0
votes0
answers372
viewsCheck PDO query return to delete or insert records
I’m making a select for deletar or inserir records in my bd according to the amount of records returned, but the tests I have done are not correct, I do not know exactly how to count the records in…
-
0
votes1
answer341
viewsInserting data with PHP using classes and PDO
Good evening guys. I have the task of creating a complete CRUD on the site where I work. However I need to use classes and methods with PHP. See what happens. I have the class usuario.class, where I…
-
0
votes1
answer257
viewsTwo selects in a while with PDO
Hello, I’m migrating from Mysql to PDO and I’m having difficulty putting in a table two selects. try{ $CON = new PDO("mysql:host=localhost;dbname=tcc", 'root', '1234'); } catch (PDOException $e) {…
-
0
votes1
answer40
viewsDuplicate data in response to a query
That is the code : $conn = new PDO('mysql:host=localhost;dbname=locadora','root',''); $resul = $conn->query("SELECT * FROM usuario"); echo "<pre>"; $resul = $resul->fetchAll(); ?> And…