Questions tagged as 'mysql'

1
answer

How to run the ProcessList periodically from the command line?

Is there any way to see the command SHOW PROCESSLIST of X in X seconds, from the command line? I'm using the Ubuntu 16 Operating System.     
asked by 03.08.2018 / 16:07
3
answers

Select the first result of each conversation

How can I select the first line of each conversation for a specific user where to_id = 1 . The big problem is when the first message changed from the conversation does not have top_id = 1 and ends up listing the next message in t...
asked by 05.08.2018 / 22:30
2
answers

Restructure table by dividing columns into rows

I have a table in the following structure: | campo1 | campo2 | campo3 | campo4 | | --------------------------------- | | valor1 | valor2 | valor3 | valor4 | | valor5 | NULL | NULL | valor8 | Among other non-relevant columns I am rest...
asked by 09.08.2018 / 17:06
1
answer

How do I cover this connection and code with the DB for PDO with utf-8 charset? [duplicate]

   My question was not clear, I edited the title, it looked just about UTF-8, but it is not, it's a connection and query conversion to PDO   with UTF-8 <?php //export.php if(isset($_POST["export"])) { $connect = mys...
asked by 12.08.2018 / 04:20
1
answer

connect in 2 banks with PDO

Hello, I connect to a bank, how would I connect with another, who has the same login and password inside the same server? follows my function: function conectaBanco() { $hostname='dbprovider.rede.local'; $username='root'; $passwor...
asked by 14.08.2018 / 13:43
1
answer

Insert text with double quotation marks in mysql database

I am using the following code to insert text with double quotes in a mysql database: mysqli_query($con, "insert into medicacaohistorico (data, unidadeori, unidadedes, itemdetalhe, qtd, solicitante, despachante) values ('".date("y-m-d")."', '"....
asked by 08.08.2018 / 14:22
1
answer

Select to List data from another table

I have a system from which I register the personal data enc_dados_pessoais and another table that stores complementary data enc_dados_complementares . In the personal data table, the user registers only the basic information and...
asked by 15.06.2015 / 16:49
3
answers

Mysql - Assign Id's to records

So, I'm having doubts about something that might not be complicated, I wanted to assign values (id's) to the records that returned it: SELECT * FROM 'aldeias' where 'userid'='-1' Doing this, will return only the id's of the villages withou...
asked by 16.06.2015 / 14:01
1
answer

Is there any command to list all foreign keys in a MYSQL table?

I would like to know how to list all foreign keys in a specific table. For example: usuarios [id, nome, nivel_id*, empresa_id*, cargo_id*] In the above case, you would list the fields empresa_id , nivel_id and cargo_id...
asked by 28.08.2018 / 19:09
1
answer

How to use foreign key in SQL statements?

I'm trying to use the foreign key but I can not. This SQL statement will create a table named tbl_estado with 4 columns id, nome, uf, pais and in column pais will enter the foreign key that will be searched in tbl_pais...
asked by 17.10.2014 / 18:36