Questions tagged as 'mysql'

1
answer

Error creating mysql function [closed]

I'm trying to create the following function: DELIMITER // FUNCTION DISTANCIA ( lat1 DOUBLE, long1 DOUBLE, lat2 DOUBLE, long2 DOUBLE ) RETURNS DOUBLE DETERMINISTIC BEGIN DECLARE d2r DOUBLE; DECLARE dlong DOUBLE; DECLARE dlat DOU...
asked by 14.01.2017 / 02:21
1
answer

Advanced SQL Query with dates

I've had a problem for days. I have my table and need to count how many grades are late, so long. I just do not know how to do this query. I need to check if they are late, to be late it has to be with a difference of 3 days from the current dat...
asked by 17.01.2017 / 12:05
1
answer

Remove Mysql record with PHP [closed]

I have a PHP page with connection to Mysql. Everything works perfectly, however I have a DELETE button, which when I click it, takes the ID of that entry, goes to a del.php page and should remove this entry in Mysql. However, "it seems" that cli...
asked by 27.02.2017 / 22:45
2
answers

retrieve DB name from a mysql and php connection

Well I make the connection in my mysql like this: $mysqli = mysqli_connect('127.0.0.1', 'root', '123', 'teste'); I want to know how to retrieve the name of the database through the variable that receives the connection '$ mysqli'. Is it...
asked by 03.03.2017 / 12:28
2
answers

how to check the time of a select in mysql with php

Well I do a select, insert in mysql with php like this: $consulta = $mysqli->query(" SELECT id, nome FROM produtos "); // Verifica erro if (!$consulta) { echo "ocorreu um erro";} How can I check if the...
asked by 02.03.2017 / 15:37
1
answer

syntax if () in a trigger

I'm having difficulty with the if () syntax in phpmyadmin. I have to create a TRIGGER to insert information into a log when the name of an animal in the animals table is changed. But it's giving syntax error in if (). When I take the if it works...
asked by 19.03.2017 / 18:56
1
answer

IF MariaDB phpmyadmin

I'm trying to create a trigger using phpmyadmin with bank MariaDB but when it arrives in the if line it gives a message:    unrecognized statement type. (near IF) The trigger is this: SET @TOTAL = (SELECT COUNT(*) FROM cliente C WHERE C...
asked by 19.03.2017 / 19:24
1
answer

Querying BD after leaving the focus of the input and returning results without refresh?

I have a table that has about 30 input fields to perform a posting, for example: <input type="text" size="8" name="Codigo[]" placeholder="Codigo" maxlength="8" /> <input type="text" size="8" name="Codigo[]" placeholder="Codigo" maxlen...
asked by 17.03.2017 / 18:39
1
answer

Function in MySQl PDO for json [closed]

I'm taking the first steps in MySQL PDO and I have 2 questions in my code. The first is related to the efficiency of the functions. The second doubt is related to the return of results from a database to insert into json_enc...
asked by 23.01.2017 / 05:12
1
answer

Implement 2 search criteria in the query (Wodpress / MySQL)

Within this query how do I add 2 more search criteria $wpdb->postmeta.meta_key = '_viewable' and $wpdb->postmeta.meta_value = 'yes' ? $query10 = $wpdb->get_results(" SELECT * FROM $wpdb->usermeta LEFT JOIN $wpdb-&g...
asked by 22.02.2017 / 15:46