Questions tagged as 'mysql'

2
answers

How to avoid duplicate registration in a table in mysql [duplicate]

How do I stop repeating the card in the registry? <?php $placa = $_POST['placa']; $cidade = $_POST['cidade']; $estado = $_POST['estado']; $query = "INSERT INTO veiculos (placa, cidade, estado) VALUES('$...
asked by 14.05.2018 / 05:01
1
answer

Temporary reservation

I have the following problem: I'm creating a booking application and once a user clicks on a product to book, that product must be removed from the list of those temporarily available to complete the reservation. If it does not finish in 5 mi...
asked by 14.05.2018 / 17:24
1
answer

How to make Create event in MYSQL?

I'm now learning about the create event in mysql I am creating a simple test event, but it is not working, it appears in Events, but the table is not updated: CREATE EVENT teste ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 10 SECOND...
asked by 03.05.2018 / 17:04
1
answer

Smallint or int to PK / Primary Key / primary key? [closed]

In languages such as Java, for example, when processing an int short and comparing with another short int, both are transformed into int. Does the same thing occur in a database like MySQL?     
asked by 03.05.2018 / 15:24
1
answer

Problem with offset and MySQL limit

When I make a query using limit and offset, the database returns one line less than it should. What is the problem? Cache? Lock Index? Data? For example: select distinct(id_table1) from table_1 join table_2 on table_2.id_table2 = table1.id_...
asked by 23.05.2018 / 01:40
0
answers

Laravel: how to insert into the database asynchronously?

I'm developing a website in PHP, using Eloquent for database, and I'm having a certain problem of slowing down the user time to log in to the database. What I mean is ... The user is taking almost 3 seconds to get logged in, and since I'm a b...
asked by 20.04.2018 / 21:03
1
answer

Organize data table HTML - CSS - SQL

I have the following code <table border="1"> <?php $sql = $mysql->prepare("SELECT id FROM usuarios WHERE status = 0"); $sql->execute(); $sql->bind_result($id); $sql->store_result(); if($sql->num_rows() == 0){...
asked by 09.04.2018 / 13:24
0
answers

Connect to the database via browser console

I have an application in JS that runs via the browser console. I would like to know the possibilities of sending and receiving data via mysql through the Console. I do not know if it's possible either. I tried something, but it did not wor...
asked by 03.04.2018 / 17:30
3
answers

save the value of a query in a php variable

I want to save the value of a select to a php variable, and then display it in the html. I tried something like: function totalEspumas(){ $banco = abrirBanco(); $quantidade_pedidos = "SELECT SUM(quantidade) from pedidos"; $resul...
asked by 04.04.2018 / 15:24
1
answer

Return Json with special characters [duplicate]

I am doing a query in the database (Php, Mysql and Ajax), the return of this query is a Json, however all the accents are coming with special characters, I put a log to see the result. Below is the code that fills my array. $sql = mysqli_que...
asked by 26.03.2018 / 22:11