Questions tagged as 'mysql'

3
answers

MYSQL How to put this date field in order

I have a date campom with all my date separated and I need to put in order as I do..get example that is not working ... $query = mysql_query("SELECT * FROM 'mensagens' ORDER BY 'ano','mes','dia' ASC") or die(mysql_error()); It leaves in ord...
asked by 07.04.2014 / 03:26
2
answers

Problem with INNER JOIN

Good evening, I'm doing a inner join of 3 tables but I can not get it to work I should have some error that I can not detect or do the right way I'm new to it inner join PHP SELECT *, (SELECT * FROM categorias_estabelecim...
asked by 30.07.2015 / 21:14
1
answer

Show latest results however with ASC ordering in PHP

I would like to show the last 10 results found in a table, but with ASC ordering. I'm using the following: $listarResultados = $pdo->prepare("SELECT * FROM teste WHERE categoria = 'cateste' ORDER BY id ASC LIMIT 10"); $listarResultados ->...
asked by 15.08.2015 / 23:15
1
answer

Working with group_concat

I have some questions regarding the use of group_concat , more specifically performance. When using group_concat you can not use limit . // a query retorna todos os ID's select group_concat( id ) from table limit 5 // pelo...
asked by 18.08.2015 / 00:53
1
answer

Error in the PDO database

I am creating a page that saves values in the MySql database using PDO and is not writing the data. I'm using the following code: <?php $conexao = new PDO('mysql:host=localhost;dbname=dbTeste', 'root', ''); $query = "INSERT INTO names(...
asked by 14.08.2015 / 20:57
1
answer

How to set up a query with optional conditions?

In the example: SELECT * FROM exemplo WHERE ID in(2, 3, 4) It does if you have these ID in the bank. PHP: $id= implode(', ', $_GET['id']); $nome= implode(', ', $_GET['nome']); $cidade= implode(', ', $_GET['cidade']); $q...
asked by 04.08.2015 / 17:51
1
answer

What is the best way to do a database backup online

There is a client of mine that has two machines, one of which is the server where all the data in the database is stored, and the other is the box. However, there is the customer's concern that something happens to the server that the data is...
asked by 06.02.2014 / 15:57
2
answers

Questions about Vagrant

I'm learning to work with the vagrant , I've already created VirtualMachine , I made the provisioning, the project ran perfectly. But when I enter via ssh in VirtualMachine to run a script php , which runs via shell, is expe...
asked by 12.02.2014 / 12:36
1
answer

How to use Elasticsearch next to MySQL? [closed]

I want to use elasticsearch to see if I can agility and speed in my MySQL queries. I started to see a few things, but I found the issue of integration with MySQL a bit confusing, does anyone have any experience with elasticsearch, and can you...
asked by 30.01.2014 / 20:12
2
answers

Determine the field in ORDER BY RAND () in mysql

Determine which table field will have ORDER BY RAND () Example: show random data according to field (category_id) How do I put a: WHERE ORDER BY RAND () id_category ???     
asked by 15.05.2014 / 16:05