Questions tagged as 'sql'

3
answers

Inserting registry and retrieving ID generated by SQL Server 2012

I want to insert a record into a table, retrieve the ID that was generated by AUTO_INCREMENT and insert records into other tables, using that ID. But, I want to do this all using BeginTransaction . How could I do this? I'm doi...
asked by 23.11.2015 / 12:49
1
answer

Doubt on MySQL Query

What code do I need to display all posts for a user? I did something like this in PHP: "SELECT * FROM postagens WHERE id='$p_id' AND u_id='$u_id';"; But always returns 0 rows: ( CREATE DATABASE IF NOT EXISTS social DEFAULT CHARACTER SET ut...
asked by 21.03.2018 / 18:45
0
answers

Using wpdb-insert correctly in function

I'm trying to insert data from the form created by pluguin Contact Form 7 to my table 'wp_wpdatatable_2', I created a hook using add_action and all right, but it does not send to the bank and I do not receive the success message (infinite loop w...
asked by 21.03.2018 / 19:14
0
answers

PostgreSQL handling of DATE

I need to import a .txt file into an sql table (The problem is not that, since I already do this import frequently) where in the .txt file the column that refers to DATAS has some fields with values " Note: I tried with String (characte...
asked by 16.03.2018 / 20:23
1
answer

Use LEAD to get the next date

I'm trying to put together a query that answers the following question: Number of customers (registration in the case) that has a 26-day reading date, number of clients that have 27-day reading, and so on up to 31 days, I will show an image e...
asked by 21.03.2018 / 06:34
0
answers

Categories and subcategories in a single SELECT

I have the following table structure: CATEGORIAS id titulo SUBCATEGORIAS id id_categoria titulo I wanted to know if there is a way to bring all categories and subcategories at once into a single select as a two-dimensional array sort of li...
asked by 14.03.2018 / 15:33
2
answers

How to create a form where it stores the data in a table and in the end you can register the data in the table in the database?

I'm creating a form where you make a record by entering 5 data (5 fields), and then by pressing the "Add" button, this data would be added in a "table" below where it shows your number, name and can be edited, or removed, while the other 5 field...
asked by 08.03.2018 / 20:24
1
answer

Group Mysql result in PHP

I have two tables in my database, the cad_usuario and the cad_automovel . The user registered in the first table can have several vehicles registered in the second table. SELECT aut.usuario_id, aut.marca, aut.modelo, aut.ano, usr....
asked by 11.04.2017 / 00:57
1
answer

SELECT with LEFT JOIN successfully but some wrong results

I need to make a SELECT using 2 tables with LEFT JOIN , I get the query successfully, however it brings me some columns with wrong results. The results of the First table are: tbUnderstand - ManuPart ----- sum (Qtd) ----...
asked by 06.03.2018 / 16:47
1
answer

Get only the lang of the class clicked

I need to get only the lang value of the clicked item, but it only takes the first value. I do not know how to solve php: $i = 0; while($rowFoto = mysqli_fetch_array($matrizFoto)) { echo "<div id='blockfoto'&g...
asked by 05.03.2018 / 19:15