Questions tagged as 'mysql'

2
answers

SQL query to identify providers available on time

I have a table for service providers that informs the schedule that are not available. id_prestador | id_pedido | hora_entrada | hora_saida 1 | abc1 | 2017-08-10 10:00:00 | 2017-08-10 14:00:00 2 | xpto2...
asked by 03.08.2017 / 14:45
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

User registry Laravel 5.4?

I'm trying to register a user on the table and is returning the following error:    SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: select count(*) as aggregate from users where...
asked by 11.04.2017 / 15:42
1
answer

What is the best way to generate random code that is not repeated in the database? [duplicate]

I need to generate a random 5 character code, can not have repetitions. I was able to do it as follows: function testarcode($code){ global $link; if ($code == ""){ return false; } $comando = "SELECT * FROM tbl_usuario...
asked by 24.07.2017 / 02:33
2
answers

How to add up the amount of records where the penultimate record enters Where?

I need a query , in MYSQL , where I check the penultimate record and that this record is equal to a certain value and counts the number of records found . Ex: penultimate record is from John. I need to count the number of times John appears...
asked by 23.08.2017 / 14:54
1
answer

Select case in two tables

I have 4 tables: Saida{ id int, idDestino int, idProduto int, tipoDestino int, quant int, data date, solicitante varchar} Paciente{ id int, nome varchar} Unidade{ id int, nome varchar} Produto{ id int, nome varchar, quant int} The sa...
asked by 12.02.2017 / 15:34
1
answer

Catch Browser Information in MySQL Procedure

Is it possible to get browser information in a PROCEDURE via MySQL code? Without having to pick up via back-end code and pass as a parameter. That is, does MySQL have any function that returns information from the browser?     
asked by 16.02.2017 / 19:20
1
answer

Fatal error error: Uncaught Error: Call to undefined function getList ()

I need to reuse this function so that it uses fetchAll but also use num_rows, the problem is that if I do return fetchAll or num_rows it works, but in that case I would have to create two functions just for one to use fetch and another rows, bec...
asked by 12.03.2017 / 22:23
2
answers

listbox with bank records

With this code I create an item in the listbox with the id number, I would like it to create an item for each id record it has in the database. Bank: Mysql Code: UWP C # using (_connection = new MySql.Data.MySqlClient.MySqlConnection("Databas...
asked by 13.03.2017 / 14:15
2
answers

Search for birthdays of the month varchar [duplicate]

Personal a customer has a datnasc field of type varchar in his database and now he wants to search for the birthdays of the month. How can I do this since the values entered in this field are in this pattern: dd/mm/aa...
asked by 16.03.2017 / 12:57