Questions tagged as 'mysql'

3
answers

How to do PHP and MySQL pagination?

I want to make a pagination on my blog. I will not have 50 posts on the first page, so I want to limit the page to the last 15 posts added and then clicking the "older posts" button will show me the oldest posts. In the background I do not want...
asked by 23.07.2014 / 16:14
1
answer

Is there timezone for Brasilia?

I'm developing an app in PHP. And you need to set Timezone to Brasilia. But in the php documentation I have: $timezones = array( 'AC' => 'America/Rio_branco', 'AL' => 'America/Maceio', 'AP' => 'America/Belem', 'AM' => 'Ame...
asked by 29.11.2017 / 16:01
1
answer

SQL query within another query

I'm performing an update on the database, but it needs to get the last ID that was written. Where does where I put another command in? In this way: $sql = mysqli_query($conexao, "UPDATE cadastro set...
asked by 01.10.2015 / 19:56
3
answers

How to repeat columns up to "x" times

I have a column in my database with names, I write it on the screen, through this code: <html> <head> <title>Pagina Inicial</title> <meta charset="utf8"> <link rel="stylesheet" type=...
asked by 28.09.2015 / 01:04
2
answers

How to sort the results of a ranking?

I'm developing a game, and in it I need to do a ranking according to the time it took the user to reach the end of the game. My question is, what kind of data should I use in my database to be able to organize when displaying the ranking?...
asked by 15.09.2015 / 19:05
2
answers

How to print the SQL statement being sent to the bank?

I would like to know how to write a SQL for control purposes of the statement being sent to the database: $sql = $pdo->query("SELECT * FROM imovel WEHRE CATEGORIA = 'APARTAMENTO'"); How to print the SQL statement being sent to the bank?...
asked by 03.10.2014 / 18:34
3
answers

Subtract date and display in YEARS, MONTHS and DAYS

DBMS: MySQL Problem: How do I return the subtract of the current date with a specific date and return the value in YEARS, MONTHS and DAYS in a query? Example: DADOS DataAdmissao dataAtual 2010-04-07 2014-06-27 (este dado não está...
asked by 27.06.2014 / 21:33
1
answer

Select rows randomly

I'm developing a very complex system, where in some cases I need to select only a few fields, a friend who has more experience in the area gave me some tips, but he did not explain why. I have the following query that searches all users in r...
asked by 07.12.2017 / 03:56
2
answers

Turn columns into rows

I have the following structure: link CREATE TABLE Viagem ( Idasemvolta int, Idacomvolta int ); INSERT INTO Viagem VALUES (64, 39) With the following select: select Idasemvolta, Idacomvolta from viagem This is not the complete st...
asked by 03.10.2018 / 15:47
3
answers

"Translate" MySQL query for SQL Server 2012

What is the SQL Server 2012 query that corresponds to the next MySQL query? REPLACE INTO schedule SET jobname = "sqldump" , last_exec_date = NOW()     
asked by 29.12.2016 / 05:51