Questions tagged as 'mysql'

2
answers

Protect from sql injection in php

I have this code to insert: $name = isset($_POST["DescricaoProd"]) ? $_POST["DescricaoProd"] : ''; $unid = isset($_POST["DescricaoUnid"]) ? $_POST["DescricaoUnid"] : ''; if (!empty($name) && !empty($unid)) { echo 'true'; } else {...
asked by 24.05.2018 / 15:27
1
answer

Create trigger automatically

I have created a code that automatically creates trigger for MySQL. But my function still has flaws, one of which is accepting the statements of PK's and FK's as if they were table fields. Look at this statement from a...
asked by 06.04.2018 / 14:33
1
answer

Query sql INNER JOIN with WHERE and GROUP BY

I have this query in my database only that I wanted to insert a sum in the a.preco_produto and do for GROUP BY only if I put GROUP BY a.codigo_loja in that query of that error > # 1064 - You have an error in your SQL synt...
asked by 27.03.2018 / 19:13
1
answer

Delete two ID's from different tables in the same query

Good afternoon! Home I have two tables: 1st questionnaire and 2nd response , and question_id is the key that allows you to interconnect the two tables, foreign key in table "answer" of the "questionnaire" table. Home When I enter a r...
asked by 26.06.2018 / 16:40
2
answers

Table filled by other tables

I need to create a table with PHP and MySQL that is populated by other tables, all tables have a cost center column, I also did a column code, for each cost center, but I'm not sure how to implement it.    codigo , periodo , em...
asked by 26.02.2018 / 12:53
1
answer

Table that shows only a few columns of the database

I have a system that: On one page has a search filter that when filled leads to another page with a table that only shows the records that meet the constraints required by the filter. The only way I know of making a table that shows the...
asked by 26.02.2018 / 15:11
2
answers

Correct Code to select and compare

I want to select * from table A that are different from table B and I have used the following code: select * from Tabela A inner join Tabela B on A1 != B1 and A2 != B2 and A3 != B3 But the computer's memory goes to the limit and blocks the...
asked by 26.02.2018 / 12:45
2
answers

Search for the last 24h lines that repeat the most (MySQL)

'SELECT 'from', 'to', count(*) AS num_clicks FROM my_rank WHERE my_rank_data BETWEEN "'.$yesterday.'" AND "'.$today.'" ORDER BY num_clicks DESC LIMIT 0,20'; Above I'm trying to get the "from" and "to" fields from a table, but I only want the l...
asked by 22.02.2018 / 02:15
1
answer

How do I sort a date field in mysql?

How do I sort a date field entered by the datepicker script in the format dd-mm-yyyy in Mysql? Note: Dates are being sorted only by day, ignoring the next month and year. And the date field is of type varchar (10). Ex: 02-05-2018 (dd-mm-...
asked by 02.05.2018 / 15:28
2
answers

Give an insert in a table with information from two tables

I would like to know how to insert two ids into two tables. For example, there are 5 tables one is a student, which has the following information: +--------+------------+ | ID_ALU | nome | +--------+------------+ | 1 | aluno 1 |...
asked by 03.05.2018 / 15:11