Questions tagged as 'mysql'

1
answer

Count Values with PHP and SQL

Well, good afternoon. I have the following question. I have a questionnaire with 10 questions, the answers to these questions can be from 0 to 5, I would like to make a while leaving counting the answers. I thought of the following way and...
asked by 22.07.2015 / 22:42
1
answer

How to describe the database of a multi-person chat

It's easy to make a conversation between 2 people, I know that, but is there someone who can cite the example of how to do a group conversation? With an unlimited number of people. Conversation between 2 people: TABELA MYSQL | De |...
asked by 29.07.2015 / 02:40
2
answers

Update date by adding in bank

Good morning, guys. I have in my database DATE fields for 'start date' and 'end date', so I can search at intervals. When I imported this data some dates were empty or non-conforming and were not recorded correctly. I would like to know: i...
asked by 14.06.2016 / 13:27
1
answer

if only execute else

Hello everyone, I have this function if it collects a variable coming from login.php and does a check to choose between two menus. But it does not matter the result inside the variable $permt it always chooses else. Someone can poi...
asked by 09.06.2016 / 02:23
2
answers

Checks if in a group of values there is a value x mysql

I have a select that returns some data from the database, but I need this select to return values only when in a group of values, there is x SELECT pessoas.id AS ID, pessoas.nom_pessoa AS nome, pessoas.cod_sexo_pes AS sexo, YEAR(FROM_DAYS(TO_D...
asked by 08.06.2016 / 21:08
3
answers

Doubt when using ON DUPLICATE KEY UPDATE

I'm trying to use ON DUPLICATE KEY UPDATE in my query and for some reason is not working. I remove the ID and do not use ON DUPLICATE KEY UPDATE : the values are saved in a new line in the bank. Example: $sql = "INS...
asked by 14.09.2015 / 17:50
1
answer

INNER JOIN with ORDER BY

In MYSQL I have two tables, product and product_photo. In the product_foto table there is a field that calls first , which normally has its value 0. In the site administrative system there may be a marking of which photo will be the first...
asked by 24.06.2016 / 16:32
1
answer

Find specific day of the week between dates

I have the following code to post to a calendar days and times available and for this I use the following routine: //recebo dados do formulario //inclusive o dia da semana ex.: Friday $dia_semana = $_POST['dia_semana']; $hora =...
asked by 23.06.2016 / 16:10
1
answer

Update in Laravel 5 a field receiving the value of another field from the same table

I have a configuration table in my database that has the following fields: ["id", "texto", "textoOriginal"] . Initially the values of the texto field are equal to the textoOriginal field, but the user can at any given time ch...
asked by 22.05.2015 / 23:12
1
answer

Do select searching for the 3 highest values

I have a table that has the following data:    id_indication, id_user, lg_client A user can indicate multiple clients (lg_client = 1) , would like a select that searches the 3 users who indicated the most, ie the three id_user that t...
asked by 31.12.2015 / 11:17