Questions tagged as 'mysql'

1
answer

Sum of the multiplication of the quantity by value of the product in daily sales

I have a page of orders, we will take as base a mercantile, where the person buys 3 soft drinks each with the value of $ 6.00 and 2 cookies in the amount of $ 2.00 each. I first need to multiply these values (3 * 6) and (2 * 2) and then add th...
asked by 07.10.2017 / 19:11
2
answers

Error comparing PHP-MySQL dates

I have the following code: HTML: <input name="dataInicio" type="text" class="form-control datepicker" placeholder="Data" maxlength="10" autocomplete="off" /> <input name="dataFim" type="text" class="form-control datepicker" place...
asked by 09.10.2017 / 22:56
1
answer

How to Migrate PosgreSQL Script to Mysql Script?

I have this database in Postgresql Script, how to convert to Msyql in order to create this database in this database? -- -- PostgreSQL database dump -- -- Started on 2010-07-03 09:40:14 SET statement_timeout = 0; SET client_encoding = 'UTF8'...
asked by 06.10.2017 / 18:30
1
answer

What is the best way to avoid sql inject [duplicate]

I have 2 ways to prevent against sql inject, they are: 1st $input = $conexao->real_escape_string($input); 2nd $input = filter_var ($input, FILTER_SANITIZE_SPECIAL_CHARS); Query select * from cadastro where nome = '".$input."'...
asked by 09.08.2017 / 18:56
1
answer

Separate column in multiple lines (split)

I have a cidade_bairro table with several cities and neighborhoods. I want to transfer this data to a new table, but on several lines instead of being in one. EX: Cidade Bairros<br> SP | Consolação-Morumbi-Saude In the n...
asked by 13.09.2017 / 20:34
3
answers

Return Id's That Are Not in the Database - MYSQL

Problem In a table X and I have N records, however these records are not sequential (throughout insert ), Id will always be greater than previous, but not necessarily the number following the previous one.) I need to know what id's...
asked by 10.08.2017 / 16:23
1
answer

Date Scheduling System

I have a scheduling system, where I have to return the dates and times available (which is not already registered in the database) for a new schedule with these available dates and times. I have no idea how to do this, can anyone give me a lig...
asked by 15.09.2017 / 04:08
1
answer

Import json file into a MySQL database?

Well I'm started in the database study and I came across the following situation I have this json file with the following data: [{"nome":"José","ddd":27,"telefone":21239990,"cpf":"11111111111","sabe_programar":true},{"nome":"João","ddd":27,"te...
asked by 16.09.2017 / 15:50
1
answer

Error using "greater than" in select command with case

I'm trying to run the following select command: SELECT estoque.id, produto.id, produto.descricao PRODUTO, case saida.quant when > 0 then (estoque.quant + sum(saida.quant)) else estoque.quant end ESTOQUE FROM estoque, saida, produto join pr...
asked by 16.08.2017 / 04:33
1
answer

How to return Primary key error already existing in PHP / MySQL?

Good afternoon. How do I return an error when there is an attempt to insert a row in a table, and the primary key already exists? By default, the database does not insert the row. How to show this error as "Existing item"? Follow part of t...
asked by 21.06.2018 / 21:01