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
answers94
views -
0
votes1
answer220
viewsMysql LIKE condition in PHP PDO
I was used to using the condition LIKE passing the parameter in connection with the MySQL and PHP via MySQLi, and I started using PDO and no result is selected when passing the value to the…
-
0
votes0
answers140
viewsCall to a Member Function result() on bool
I’m trying to get results from a Stored Procedure in the CodeIgniter, in the bank brings the result normally but in the CodeIgniter brings that mistake: in my model is like this: public function…
-
0
votes2
answers38
viewsFind an input value within an AJAX loop
I confess that I have been for a while in this small challenge, I am developing the cart part in my Ecommerce. The goal is to display a message, the user click on "Add to cart" of a particular…
-
0
votes0
answers35
viewsMYSQL change float field to decimal
My queries using PHP PDO in Mysql FLOAT fields do not find results with cents. It seems to me that PHP PDO always sends the value of the variable as a string. Even with the variable typed in float.…
-
0
votes1
answer50
viewslastInsertId returns 0 (zero)
I need to get the ID of my last INSERT in the database, however the function lastInsertId() only returns me 0. This is my class that connects to the bank: <?php namespace App\model; class…
-
0
votes1
answer49
viewsError when reading some words using percentage wildcard character (%)
Hello. I’m making some queries to the database that uses the PDO. When I make the appointment without the % at the beginning of the condition, the results return correctly. Ex.: $localizacoes =…
-
0
votes1
answer52
viewsFunction to simplify records in Mysql with PDO - You are saving all identical values
I am trying to create a function to simplify insertion of records in Mysql using PDO. The function is working but recording identical values. Follow the PHP script: <?php function…
-
0
votes0
answers31
viewshow to traverse each row of an object array and display on the screen (PHP)
I am having a problem displaying a query(Select) of some items on the screen. It is only displaying the first line. <?php require_once 'app/Lib/Database/Connection.php'; require_once…
-
0
votes0
answers43
viewsHow to pass String filter in a change from Mysqli to PDO in PHP?
// Mysqli $vf = mysql_query('SELECT id, cnpj, id_erp, fantasia, razao FROM usuarios WHERE nivel="3" AND ( nome LIKE "%' . limpa($_POST['termo']) . '%" OR email LIKE "%' . limpa($_POST['termo']) .…
-
0
votes2
answers61
viewsPOST via AJAX is safe?
I’m studying a little bit about web programming, and trying to create a virtual store to train, but some things are still not very clear to me. I am trying to assemble the part of user registration/…
-
0
votes1
answer42
viewsDisable mysql value checking
I have a system running on a VPS that was done by me on localhost (but on another computer). This system was made in php and connects to a mysql database in the VPS itself. Now, I am cloning…
-
0
votes0
answers35
viewsQuery of two or more mssql Pdo tables
Query of two or more mssql Pdo tables, the connection is normal. I’m having a little trouble. I have 2 tables. profile id | name | birth date | Address connections id | idperfil | data I’m trying to…
-
0
votes0
answers42
viewsLoad . SQL file and run with PDO
Well I am mounting a small code in PHP 8, PDO and Mysql 8. It will be responsible for creating a bunch of data and loading the tables from a file. SQL So far I’m doing it this way: // Tenho as…
-
0
votes1
answer50
viewsI am making an online calendar and can not have 2 schedules scheduled on the same day and at the same time for the same professional Mysql PHP PDO
I’m making a website for a barber shop and I need to solve a little problem, in this schedule there are 3 professionals who work in the barbershop, and have the option of choosing the professional,…
-
0
votes2
answers19
viewsHow to use select with php and Pdo
Hi, how are you? I am learning database with php, was creating a class named crud where there is a select function to remove data from the database, however, after select, the result is always 0,…
-
-1
votes1
answer255
viewsError loading PDO extension
I transitioned from my site using personnel but on the new server it accuses the following error: The PDO Extension is required for this Adapter but the Extension is not Loaded Note: I’ve already…
-
-1
votes1
answer100
viewsMysql connection by Pdo does not exist
I can’t connect to my database, I have no errors, the connection just doesn’t happen, just gives me a blank page. I have these 4 small files responsible for Conn. init.php: <?php session_start();…
-
-1
votes1
answer95
viewsProblems with Pdo error while creating logerror.txt file
Notice: Undefined variable: strErro <?php class DB{ private static $conn; static function getConn(){ if(is_null(self::$conn)){ self::$conn = new…
-
-1
votes2
answers548
viewsHow to generate error in logerror.txt file?
I am trying to generate errors in the file logerro.txt, but I don’t know how to do it. I used the syntax error function: try{ }else(PDOException $e){ echo'Sistema indisponível'; LogErros($e); I used…
-
-1
votes1
answer466
viewsHow to search all the records in the database?
Help me out, guys!!! $BuscaProdutosAtivos = $pdo->prepare("SELECT * FROM tbl_produtos p INNER JOIN tbl_categorias c ON c.cat_id = p.prod_categoria INNER JOIN tbl_variacoes v ON v.cod_prod = p.id…
-
-1
votes2
answers2313
viewsLogin and password with permission level in php
I am set up a system to facilitate communication and support to representatives of the company where I work. The rest of the page already exists, but I need to make each type of user be directed to…
-
-1
votes2
answers194
viewsSchedule of commitments using fetchAll(PDO::FETCH_NAMED)
I am using fetchAll(PDO::FETCH_NAMED) to retrieve records from my database. received the following array Array ( [0] => Array ( [idAgenda] => 2 [dataAgenda] => 1996-02-14 [localAgenda]…
-
-1
votes1
answer1674
viewsAvoid date and time duplicity for the same scheduling professional
Friends I’m trying to create an agenda for a dental clinic, but I’m having a hard time preventing the client from scheduling a date and time that has already been scheduled for that selected…
-
-1
votes1
answer559
viewsError 403 - Password validation forbidden access with Mysql in PHP7 code, how to fix?
Good afternoon guys, I am taking a course of a real estate portal system in PHP that I bought and I I stopped at the time to make the portal login system. The course uses PHP below version 5 and the…
-
-1
votes1
answer4734
viewsSQLSTATE[HY093]: Invalid Parameter number: Parameter was not defined
0 /opt/lampp/htdocs/Renan/conexion.php(53): Pdostatement->execute(Array) 1 /opt/lampp/htdocs/Renan/conexion.php(72): Conexaodatabase->execute(Object(Pdostatement), Array) 2…
-
-1
votes4
answers582
viewsHow do I SELECT then INSERT
How do I select and return more than 1 record does the UPDATE and return 0 records does the INSERT ? Look how I did it here only it’s not working: if(isset($_POST['submit'])){ $query =…
-
-1
votes1
answer153
viewsHow to use password_hash in select
How do I login with the entire encrypted password ? I used password_hash and now for me to log in as I do ? if(isset($_POST['loggin'])) { $user = trim(strip_tags($_POST['user'])); $txtpassword =…
-
-1
votes1
answer169
viewsTake data related to more than one table separately?
There’s no way I’m doing this. It seems to be with Join, but when I try, returns me zero records. I have the tables: TB1, TB2, TB3, TB4, TB...etc All with PK (ID) I tried that code: SELECT ID FROM…
-
-1
votes1
answer172
viewsred/negative and green/positive
I have a table that, time the value is negative and, time is positive. I would like these values to be green or red. But, I couldn’t do it. Currently my select is being presented this way: (php,…
-
-1
votes1
answer120
viewsMake an encrypted Mysql database connection
To make a connection to the Mysql database use this code in PHP: $host = "host"; $usuario = "usuario"; $banco = "banco"; $senha = "senha"; $pdo = new PDO('mysql:host='.$host.';dbname='.$banco,…
-
-1
votes1
answer1059
views"Call to Undefined method mysqli_result::fetchAll()" in PDO
The following code displays an undefined method error on the line: $result = ($exec!==false)?$exec->fetchAll(PDO::FETCH_ASSOC):$exec; public function getConnection(){ global $conn; $this->conn…
-
-1
votes1
answer381
views -
-1
votes1
answer396
viewsQuery error: 'SQLSTATE[42000]
I’m making database data call with php and PDO , but whenever I do it with bindparam(); give me the following mistake: Fatal error: Uncaught Exception 'Pdoexception' with message 'SQLSTATE[42000]:…
-
-1
votes1
answer133
viewsUndefined index array Pdo
good people I’m trying to get the id of a user who logged in and saved in the session but , not working, I make a query in the bank when logging in and turn the result into an array to pick up the…
-
-1
votes1
answer69
viewserror in my_sql to PDO conversion
I modified my connection page with the MYSQL database to PDO but it is showing error, could anyone help me? There is a file that pulls the necessary information from the database to be sent to the…
-
-1
votes1
answer275
viewsHow to delete data from multiple tables at the same time?
People for security I decided to use Transaction, I hope it works like this: Concludes only if all the querys rotate. You suggest something better? <?php if (isset($_GET['deletar']) &&…
-
-1
votes1
answer326
viewsHelp with PDO (PREPARE)
Hello. I am trying to make a CRUD using PHP OO. But when I run, I have an error in the preparation of the PDO class. I have only the bank registration code and the bank connection code for now:…
-
-1
votes1
answer44
viewsI’m having trouble inserting PDO data
I have checked this code several times and I did not find the error, please help me find and correct... echo"email = ".$email. "<br>" ; echo "ddd = ".$ddd ."<br>"; echo "telefone =…
-
-1
votes1
answer74
viewsDoubt about alternative to decrease code size and make fewer queries
I have a question regarding a certain part of a system that I am developing. The system is for management of a higher education institution and has a page that is to administer the courses of the…
-
-1
votes1
answer113
viewsHow to do multiple run with PDO
I have a very simple user update form, but I am not able to successfully update using PDO and mysql. Follow the excerpt of the code I’m in trouble with: if (isset($_POST['ID'])){//Se informar o ID…
-
-1
votes1
answer269
viewsError inserting data into PHP PDO database
I am trying to create a new register in the bank with the following code and returns the error: Insert value list does not match column list or os the record is created but blank, since the fields…
-
-1
votes1
answer25
views -
-1
votes1
answer256
viewsWhich of these 3 PDO codes has the best performance?
Purpose: Select a single line with LIMIT 1 Internal Use: The selects receive only internal parameters You don’t need PREPARE because there is no external user data $pdo = new…
-
-1
votes1
answer1269
viewsHow to return the id of the user in the session
require_once('conexao.php'); @$email = $_POST['email']; @$senha = md5($_POST['senha']); // $email = "[email protected]"; // $senha = "12346"; $pdo = $dbconn->prepare("SELECT userid, nome,…
-
-1
votes1
answer27
viewsAccessing method (beginner)
I started my studies recently and a question arose regarding the access of information of a method. I have an X.php file that has the following structure: public function…
-
-1
votes1
answer77
viewsProblem when changing using Pdo
I’m developing a system for college and I’m having the following problem Notice: Undefined property: stdClass::$Disciplina in C:\Users\lucas.vianna\Desktop\SGA\db\turmaDAO.php on line 64 Notice:…
-
-1
votes1
answer857
viewsValidate PHP Login PDO MYSQL
Hello I’m starting with php already engaged in the world of PDO and I’m with a doubts in my code I want to check if the login exists and is the same that was entered, if for returns "existing login"…
-
-1
votes1
answer1279
viewsUsing mysql_num_rows with PDO
I changed the method of connecting my page to my database via PDO. I used until then a pagination code only that is now returning the error: Warning: mysql_num_rows() expects Parameter 1 to be…
-
-1
votes1
answer81
viewsDoes my SQL Query not work properly?
I have a system that uses dates for registration and I separate the date by a explode formed by arrays and record them in a database, but when I do the query that searches them by order, the order…