Questions tagged as 'mysql'

3
answers

Receive json mysql data

Hello, I have the following function to read DB data mysql. Here I call - > $clientes = DBRead('clientes', null, 'nome, telefone1'); Here I display - > echo $nam = json_encode($clientes); Result: [ { "nome":"Davi",...
asked by 30.03.2016 / 17:00
1
answer

UPDATE with different conditions in the same query

How to update multiple records by setting different values, eg: $update = "UPDATE tabela SET ativo=1, nivel=2 WHERE nome ='jose' AND nome='maria' AND n...
asked by 18.04.2016 / 21:26
1
answer

How do I update a field using it at the same time?

I would like to know if you have a way to sum the value of a line with itself without having to query after an update. I have a column called total that holds integers, at some point I want the value that is on this line to be s...
asked by 21.09.2016 / 05:05
1
answer

Select with Search Terms

I need to make an query where I only display results in one condition: # Search the Database $select_sql = "SELECT * FROM users WHERE user LIKE :search OR date_access LIKE :search OR ip LIKE :search AND active LIKE :active ORDER BY id DESC"; $...
asked by 14.09.2016 / 21:49
2
answers

Compare data sql

I need to compare date at a certain time interval. I need to get the DAT_REPOT_REALZ field and check the dates between TODAY and seven days ago. I also need to count the number of V (visitor) and the number of L (leader) and M (participan...
asked by 12.02.2016 / 11:40
2
answers

INSERT duplicate with mysql :: PDO

Can anyone explain why when I run this code it INSERT twice the same value in the table? I believe that this problem happens when I do a validation to verify that the values have been entered: if(!$lc_follow_dados->execute())...
asked by 10.02.2016 / 15:34
2
answers

Validation Login and Password Primeface and JSF

I have a very simple system of Registration and Login, I have done a validation in both fields. I want to adapt this validation to something more specific like: Login does not exist Invalid password Currently my validation has a sing...
asked by 29.06.2016 / 17:29
1
answer

Bring Existing and Non-Existing Records

I have the following scene: $consulta = Dealer::find(1); No Model # Serviços public function dealer_servicos(){ return $this->hasMany('App\DealerService', 'id_concessionaria'); } Then if I do: @foreach($consulta->dealer...
asked by 25.05.2016 / 14:16
2
answers

SQL - How to select or delete a column with a value of null in a query select

I have a table in a MySQL bd that has 5 fields. This would be a template query: select * from myTable where campo1= 4 and campo2=1 and campo3 =7. However, field3 may have null value and I would need to select or exclude combinations that in...
asked by 24.05.2016 / 21:52
1
answer

Select one product per establishment in the mysql database!

I have a database with the tables estabelecimentos and produtos . Register the products relating to the establishments. I need to make an appointment where I only select one product from each establishment, I thought about doing...
asked by 12.01.2016 / 20:10