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
votes0
answers17
viewsCombobox updating the database data
I am developing a page that will serve to edit the support calls : open, pending and solved. But before the fields I created in Mysql I cannot update to update what I want. <form role="form"…
-
1
votes1
answer49
viewsPDO does not return error even in a Try catch block
I was trying to register in a mysql database using PDO. Do not register but even so I did not have an error return despite the block try catch. I later discovered that the error was the column size…
-
0
votes1
answer335
viewsWhat causes "Call to a Member Function fetchAll() on a non-object in..."?
I made a class for connection to the database using PDO and at the time I will get the data from my table it gives this error. This is the code: require_once('../class/connection.class.php'); $db =…
-
0
votes1
answer870
viewsPdo UPDATE does not work
I’m trying to send some values to SQL, but PDO does not work as it should, or I’m forgetting something, I’m new to using PDO. Example of functional code. $conn = new…
-
0
votes0
answers33
views -
0
votes1
answer1336
viewsHow to get the next ID to be inserted?
I’d like to get the next ID inserted, something like: $ultimoid = (DB::lastInsertId()); $futuroid = ( $ultimoid + 1 ); The goal is to previously know the ID that will be used in my INSERT because…
-
0
votes1
answer112
viewsSwitch Case PDO does not display
Changed further inside the title yet, the case works but does not display the result. <?php $sql = "SELECT tipo FROM publicidade WHERE posicao='Lateral' ORDER BY RAND() LIMIT 1"; $stmt =…
-
0
votes1
answer172
viewsSelect with JOIN to return an Object with Internal List
I wonder if it is possible to select with Join where the second table will return more than one row and in that create an object with an internal list. For clarity see the example: Tabela Usuario:…
-
0
votes1
answer365
viewsHow to make a query to return the value of another table?
Table PRODUTOS id nomedoproduct categoriadoproduct valordoproduct Table CATEGORIAS id nomedacategoria In my form I show the name of the category but register in the database in the table PRODUTOS…
-
0
votes1
answer342
viewsUnlink for multiple files
I am trying to use unlink to delete from a directory several images do not know what is happening apparently the logic is correct, my method is as follows: public function deleteImagem($id) {…
-
0
votes1
answer452
viewsReturn value from select
$sql = "SELECT username, mail, password FROM users WHERE username = :user_name OR mail = :user_name;"; $query = $this->db->prepare($sql); $query->bindParam(':user_name', $user_name);…
-
0
votes1
answer258
viewsProblem when trying to insert into mysql using PDO
I have a problem when I try to insert from a form <form method="post" action="../../controller/inserirContato.php"> <label for="name" class="nameLabel">Meu nome é: </label>…
-
0
votes1
answer144
viewsWhy create the folder and not upload the image in sequence?
if ($_POST['salvar']) { $titulo = $_POST['titulo']; $conteudo = $_POST['conteudo']; $imagem = $_POST['imagem']; // titulo duplicado $sql = "SELECT * FROM noticias WHERE (titulo=:titulo)"; $stmt =…
-
0
votes1
answer230
viewsHow to view the SQL executed by php when using the functions "prepare()" and "execute()"?
Hello need to echo or print the SQL running from the function below. The goal is to visualize how the SQL will look when the values of "?" replaced. Does anyone know how to do this? public Function…
-
0
votes1
answer349
views -
0
votes1
answer479
viewsPredict next Bank ID
Good staff I’m wanting to better organize the images of the posts but for that I need to know what will be the next ID so I check the image first before entering the rest of the data. if…
-
0
votes0
answers239
viewsHow to mount the return Json
I don’t know how to do it or who to turn to. I need to make this json return with Jquery.Ajax I’d like to pass parameters more or less like this In JAVASCRIPT I have so $.ajax({ type: "POST", url:…
-
0
votes1
answer272
viewsSearch login user record in mysql
I have a followers exchange system, where the user logs in to the panel and use his list so I created a texarea so he can put his list which is in the format email@provider:password and then save…
-
0
votes1
answer430
viewsHow to return only the last result of more than one field of the same table?
I’m trying to make a PM’s system in php script I want to make a list of unread messages but I want to show only one entry (the last one) of each user I send a message...in the script I did shows all…
-
0
votes1
answer261
viewsHelp with Editing PHP PDO
I’m pulling data from a table in sqlsrv to an html table because I often need to edit this data in that table. So I created a php edit function to edit the table row on another page only that is not…
-
0
votes1
answer54
viewsproblems with bindValue
$query = "INSERT INTO " . $this->table_name . " (data, sexo) VALUES (:data,:sexo)"; $stmt->bindValue(':data', $_REQUEST['data']); $stmt->bindValue(':sexo', $_REQUEST['sexo']); is making a…
-
0
votes1
answer354
viewsBest form Select tag in Php without framework with DAO project pattern
I have a question about the best way to implement a method that runs through a common select using DAO standard with PDO. It would be appropriate for me to do so, my entire code in the view:…
-
0
votes0
answers458
views -
0
votes0
answers80
viewsProblem with INSERT PDO
Hello friends I am very layman in PDO and I would like the help of friends to try to create an INSERT that registers a font name in the BD source table. Next, I created this code below, based on the…
-
0
votes1
answer473
viewsConcatenate in the PDO query
I’ve heard that when concatenating into a query using PDO can cause slowdowns and even leave the system vulnerable, this is true? I want to concatenate into one query and I’m afraid to take certain…
-
0
votes1
answer337
viewsList two mysql Pdo tables
$catalog = $dbh->prepare("SELECT * FROM catalogo WHERE ativo = 2 ORDER BY catalogo_view DESC LIMIT 0,5"); $catalog->execute(); I want to search between two tables, as I do?…
-
0
votes0
answers829
viewsDo not display null lines in mysql results
I have a simple mysql query SELECT usr_contact FROM $usr_ I use PDO to connect this table has lines that have empty fields thus ----------------------- | id |usr_contact| ----------------------- |…
-
0
votes1
answer221
viewsMVC connection, which one to use Msqli or PDO?
I’m starting to program a PHP MVC, which type of connection is most recommended: Msqli or PDO and why?
-
0
votes1
answer324
viewsHandling CRUD Array PDO data
list-dish.php: <?php //inclui as bibliotecas require_once('conexao.class.php'); //faz a canexão $pdo = new Conexao(); // determina o numero de registros que serão visualisados $maximo = 20; //…
-
0
votes0
answers227
viewsPHP:PDO connection pool with Postgresql, what to use?
Thinking about the following scheme: Linux Server (may be Ubuntu Server) + PHP using PDO + Postgresql + Apache HTTP server + Some pool of connection I would like some pool tip (that is reliable) to…
-
0
votes1
answer257
viewsDisplaying saved image in PHP database /Restaurant
$pdo->bindValue( ':img_prato' , $_REQUEST['img_prato']); = sw-profile.jpg How do I display the image, not the path? Insert.php <?php require_once 'usuario.php'; require_once…
-
0
votes1
answer621
viewsHandle query postgres errors
Using PDO and Postgres, but with difficulty to get the query Exception, for example error in syntax. I’m grateful if anyone can shed some light!!
-
0
votes0
answers51
viewsOnly get the bank’s final value
I’m using the php with Pdo to query a database in postgress. Is there any way that when you do the query, show the result without having to enter the table name, since select is unique? select…
-
0
votes1
answer40
viewsDatabase Encoding - German Characters
I come across a strange situation, when I try to insert German characters(ě,ě) into the database they are inserted as follows: "üüü " The field is defined as utf8_general_ci If you enter the data…
-
0
votes0
answers133
views -
0
votes0
answers55
viewsError in PHP PDO Class
Guys I’m trying to use the PDO class in one of my systems and this error is appearing, and the PDO class is already installed. Fatal error: Class 'PDO' not found in…
-
0
votes1
answer44
viewsDatabase - table list
Personal as I can list all the BD table and put in a table, list or in any one corner of the page?
-
0
votes0
answers39
viewsSave Arrayiterator to Mysql
I’m having trouble saving a list of items on ArrayInterator, where I need to save this data to the table by clicking a save button. Array code: <?php ... $p = new…
-
0
votes1
answer596
viewsResult Search PDO PHP Does not return a field
I make an sql query using PHP PDO. When checking the query result, the value of a field returns empty, but the field has value. Using the SQL sentence directly in phpMyAdmin the result returns…
-
0
votes1
answer79
viewsLike postgres PDO with foreach
I need to use a like in foreach but without success, I did as follows: $arr = array('\'%a%\'', '\'%b%\'', '\'%c%\''); foreach ($arr as $a){ $this->SQL = "update client set active=1 where date…
-
0
votes1
answer46
viewsHow to mount key vaue array pair to insert into table?
$key = "id,name"; $val = "'$lastid','$autor'"; ... if ($email){ $key .= ",email"; $val .= ",'$email'"; } ... $keys = \explode(',', $key); $vals = \explode(',', $val); $arr =…
-
0
votes1
answer253
viewsSybase 15 and Laravel 5.1 via ODBC and Error 3811
I have a database in Sybase (Adaptive Server Enterprise) and we started using the Laravel framework to transfer existing systems to it (a migration in BD cannot be contemplated). Laravel by default…
-
0
votes2
answers127
viewsCode only returns me the first row of the table referring to the patient ID
The code only returns me the first row of the table referring to the patient ID <?php require 'conexao.php'; // Recebe o id do exame do exame via GET $id_exames = (isset($_GET['id'])) ?…
-
0
votes2
answers1126
viewsPassword encryption on MD5?
What security does the MD5 bring if the encryption of a password is only in the database in the password field? If by chance the system is invaded by which want another breach MD5 would influence…
-
0
votes2
answers1804
viewsPhp connected with SQL Server
How can I connect php to sqlserver (Pdo)? It seems simple, but I’m not getting... I’ve enabled the driver all ok Attached is the name of the server, I will run in place ...…
-
0
votes0
answers38
viewsWhich is safer PDO or mysqli_*?
I was reading and I saw that many say, PDO merely simulates the prepared statements and consider a disadvantage, I wonder then... Which is safer? Or which is more susceptible to SQL Injection or any…
-
0
votes0
answers157
viewsHow to install sqlsrv driver on Pdo?
How do I install or sqlsrv driver on Pdo? <?php function conectar(){ $pdo = null; try { $opcoes = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION); $pdo = new…
-
0
votes0
answers124
viewsHow to set time_zone using PDO
I have a connection using PDO what arrow the SET NAMES UTF8: $options = [ PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES UTF8" ]; But I’d like to add the SET time_zone='America/Sao_Paulo'.But in…
-
0
votes0
answers234
viewsHow can I apply bank information to modal?
Well, I’m working on my computer CBT, and its purpose is to control the output of students. I managed to make registration system, deletion, I am already working on the edition, however I would like…
-
0
votes1
answer193
viewsPHP Warning: imagecreatefromjpeg()
PHP Warning: Division by zero in /home/u215177984/public_html/classes/Panel.class.php on line 19 PHP Warning: imagecreatetruecolor(): Invalid image Dimensions in…