Questions tagged as 'mysql'

2
answers

Pull information last information that will use to make comparison

I have a question in SQL, what I want is that the code pulls the last information from this column and compares with a label on my site, but I do not know if the Last Insert Id is better or correct to use. > SELECT Km_Atual FROM Rota WHERE Km_A...
asked by 12.06.2017 / 20:56
1
answer

Function mysql_insert_id () returns only zero

Personally I'm having problems with the mysql_insert_id () function, when I use the form below the value returned is always "0" (zero). Can you help me? The "add" function calls the "save" function. OPEN_DATABASE FUNCTION // ABRE A BASE...
asked by 28.06.2017 / 15:50
2
answers

How to separate string in array?

I have a descri_produto column that would be the product description. The problem is that I can not separate the description into an array. $cat = $_POST['categoria']; $sql= "SELECT DISTINCT descri_produto, cat_produto FROM produtos...
asked by 12.06.2017 / 20:28
1
answer

Create variable in iReport for the database

I need to create a report of the selected month with the information contained in the database, so I want to create a variable in iReport that receives the month (by netbens) which will be compared to the existing sqll in Ireport that is connect...
asked by 16.08.2017 / 16:41
1
answer

Run 2 'SUM' on an 'UPDATE'

I'm trying to make the SUM of two fields different and give a UPDATE in another table. I'm doing this: UPDATE pedidos a SET custo = ( SELECT case when SUM((b.qtd - b.qtd_devo...
asked by 28.07.2017 / 23:41
2
answers

Refresh table field with information from another column

How to do an update that retrieves data from one column and plays in another column? For example Sales IdVenda | dataVenda | dataPgto 1 | 2017-08-21 | 2 | 2017-08-21 | Do I want to update the dataPgto with the date informat...
asked by 21.08.2017 / 22:07
2
answers

Insert field php concatenating date

I would like to know how to insert the following combination, via PHP or mysql: I have a field called YEAR that needs to receive the current YEAR 2017 format via php or mysql. I have a code field that will need to concatenate the protocol...
asked by 21.08.2017 / 16:21
1
answer

How to select the name of a column in MySQL?

How to get the name of a column in MySQL even though it has no rows?     
asked by 11.07.2017 / 21:45
1
answer

Use specific data types like SMALLINT and MEDIUMINT instead of INT and mark columns with UNSIGNED is an exaggeration?

Speaking of databases, we know that they have several data types to use in each specific situation. But, following the data types to the letter can be considered an exaggeration in most cases or is it always recommended, even giving more work to...
asked by 05.06.2017 / 02:29
1
answer

Save visit cookie on page

Hello, I am using a php mysql code that counts the visits of each page, however whenever the page is updated it adds one more visit, I would like a help with my code so that it saves the cookie for a certain time before tell a new visit. PS: E...
asked by 02.06.2017 / 23:11