Questions tagged as 'mysql'

4
answers

How to make MySql return utf-8?

When requesting information from my bank that contains special characters I get " " but in phpmyadmin in grouping is "UTF-8" and my site also has the UTF-8 goal what can I do to return the correct one?     
asked by 15.08.2017 / 20:59
3
answers

Why is ':' used in queries?

I was seeing a script in php and I noticed that every time an SQL query was written, this "operator" was used. A part of the code $sql = "INSERT INTO categorias (nome) VALUES(:nome)"; $stmt = DB::prepare($sql); $stmt->bindParam("nome", $...
asked by 25.07.2014 / 17:55
2
answers

Why does max or min return the expected value?

I need to get the highest and lowest value of a certain field to be able to make a filter, only SELECT MAX nor MIN does not work. As you can see in the image below, I need this amount of users Table name: prt_license SELECT MAX(use...
asked by 19.06.2017 / 20:54
5
answers

How to calculate the age based on the DATE of birth in MySQL based on the month and day?

I have the query below, but it ignores the month and day of birth SELECT FLOOR(DATEDIFF(NOW(), c.nascimento) / 365) AS idade FROM clientes c In the result, most comes right, but sometimes has a difference of one year. How to make th...
asked by 25.03.2014 / 01:19
3
answers

How do I adjust my date in my query?

$result_usuario = "SELECT * FROM vendas WHERE DATE(date_created) = '$data' AND tipo_venda = '$tipo_vendas' AND tipo = '$tipo_pagamento' ORDER BY 'id'"; I have this query, but it does not work right because the input that populates t...
asked by 12.12.2018 / 19:57
2
answers

Comparing prepare () vs query () with mysqli

I made a query in the database, with query() using mysqli and num_rows to return the number of lines, see the code: $consulta = $mysqli -> query("SELECT * FROM tabela WHERE Pedido = '$pedido' AND Email = '$email' "); $linhas =...
asked by 19.01.2015 / 15:10
3
answers

Bash - Mysql Backups

I set up the script below to perform backups of three Mysql databases. I wonder if it's correct. #VARIAVEIS DATE='date +%Y%m%d-%H%M' HOSTNAME1="xxxxx" HOSTNAME2="yyyyy" HOSTNAME3="zzzzz" USER='xyzedmar' PASSWORD='xyz2' DATABASE1='xxxxx' DATABA...
asked by 07.12.2015 / 22:51
1
answer

Error when using Group by in a VIEW in Mysql

I created a VIEW to return the main data I need in a single query. CREATE ALGORITHM = UNDEFINED DEFINER = 'root'@'localhost' SQL SECURITY DEFINER VIEW v_historicoProcesso AS SELECT p.protocolo AS protocolo ,p.der AS der ,p.dat...
asked by 05.12.2015 / 23:18
3
answers

How to give a MySQL field line break in an HTML page

I need to save a value with a line break in the table For example, instead of saving: 0 anos, 3 dias Save: 0 Anos 3 Dias I tried the following process: INSERT INTO tabela (tempo) VALUES ('0 Anos\n3 Dias'); He even broke the cod...
asked by 10.04.2015 / 00:18
3
answers

How to create executable program in PHP?

Is it possible for me to create a program for my company that is executable only with PHP and MySQL? Or I'll need other languages, like C, Java, etc ... In case the program is internal only.     
asked by 21.06.2017 / 22:49