Questions tagged as 'pdo'

1
answer

How do I get the next ID to be inserted?

I would like to get the next ID to be inserted, something like: $ultimoid = (DB::lastInsertId()); $futuroid = ( $ultimoid + 1 ); The purpose is to know beforehand the ID that will be used in my INSERT because before even inserting the recor...
asked by 01.01.2015 / 20:45
1
answer

pdo UPDATE does not work

I'm trying to send some values to SQL, but the PDO does not work as it should, or I'm forgetting something, I'm new to using PDO. Functional code example. $conn = new PDO('mysql:dbname=config_database;host=127.0.0.1', 'root', ''); $...
asked by 11.06.2014 / 21:24
2
answers

Insert with PDO and INNER JOIN

I have a person table that has the name, city, and phone fields and time_id. I also have another table with a team name and in it I have a field called my_time, how can I make an INNER JOIN to register the team in that time table but in the pers...
asked by 29.06.2018 / 12:59
1
answer

What does the RFP Prepare do when we use it?

What exactly does it prepare you for? For example, does it encrypt, or something like that? Because, frankly, I use the method, but I never quite understood its use. <html> <head></head> <body> <?php...
asked by 21.07.2018 / 04:19
2
answers

PHP - Return sum of columns at specified date // PDO

> For example: A person who sees the sum of the integers of these two columns for 2016-09-20 . How to do this script? ( PDO ) In case he should return the sum of 25.5 ... Thegeneralreturn,howevernotsummedandtbmseparate...$bsc_us...
asked by 18.09.2016 / 03:08
4
answers

PDOStatement :: rowCount returns -1

I need to know how many records were entered in the query below. public function CadastraCliente() { $this->conn->beginTransaction(); try { $stmt = $this->conn->prepare(" INSERT INTO SISCli (CdInscricao,...
asked by 24.08.2017 / 17:07
2
answers

How to display the Options (HTML) with the elements of the Database

Hello, I am trying to do the following: I want the elements that are registered in the database to appear inside a "Select - Option (FORM - HTML)". Ex: <body> <?php include("conexa.php"); $id = 80; $pegadiv = $PDO->query("SELECT...
asked by 17.09.2017 / 19:46
1
answer

Problems with PDO parameter passing

I'm studying a book in which I have to do some queries through a TableDataGateway pattern design but I'm getting the following error message:    Fatal error: Uncaught Error: Class 'classes \ tgd \ PDO' not found in C: \ xampp   \ htdocs \ lib...
asked by 25.10.2017 / 22:31
1
answer

Know the position in a listing

I'm using this query to know how many comments a user has made: $comentarios = $pdo->query("SELECT * FROM topicos_comentarios WHERE autor='".$ver['autor']."'")->rowCount(); However, I would like to know what his position in the over...
asked by 28.05.2017 / 21:46
1
answer

What kind of PDO :: FETCH_ * is the fastest?

As far as I know, there are 5 ways to do it, but the official documentation is displayed about 8 different ways to make a FETCH_* . I would like to know, of all the ways to PDO::FETCH_* , which is the fastest to use?     
asked by 07.06.2017 / 21:45