Questions tagged as 'mysql'

4
answers

How to use Try Catch in an insert

How do I use a try catch to return me an error from an insert that was not inserted into the database. For example $sql = $pdo->prepare("INSERT INTO usuarios (nome,email,senha,telefone) VALUES (:nome,:email,:senha,:telefone)"); $sql->...
asked by 28.06.2018 / 22:14
2
answers

Block user access with foreign IP's

Is it possible to restrict access to a particular site or Web system, so that only Brazilian IP's can access it? I have a mini-system in PHP, and to further enhance your security, I'd like to make it inaccessible to all types of foreign acces...
asked by 15.05.2018 / 03:59
3
answers

Generate Excel with query php

I need some help. I have a query in php and mysql and I would like to add to this query the option to export the data also to excel. Is it possible to do this with php? <div id="tabs"> <ul> <li><a href="#tabs-1">Inf...
asked by 26.05.2014 / 18:20
3
answers

Search in 3 unrelated Mysql tables [duplicate]

On a system, I have 03 internal search types: And I would like to look at 03 unrelated tables:    table1, table2, and table3 For this, I tried the commands below: SELECT * FROM 'tabela1' WHERE NomeUsuarios LIKE 'Davi%' UNION...
asked by 28.05.2018 / 03:48
1
answer

Check current date automatically

I'm developing a system with PHP where: I've made available a contest entry page for staff, but this page has an end time, example: The page will be available from today 05/08/18: 17:11 and will disappear on 09/05/18 23:59:00. I know I ca...
asked by 08.05.2018 / 22:16
2
answers

Select certain amount of data for each type status

Billy Jow here! In my historical table I have a status field that can take four possible values: 'EVALUATE', 'FAIL', 'REVOK', 'SUCCESS' I want to select 20 records of each status where the date is most recent. Since I want only th...
asked by 11.11.2017 / 14:33
1
answer

What is the safest way to display ID (DB primary key) in web pages?

I'm developing a web application, which in some cases would need to be available in the HTML (so JS can interact) user publications ID, comments ID and others ... Example: <div id="cmt_IDDOCOMENTARIO" class="comment-text"> Comentár...
asked by 07.03.2018 / 15:40
4
answers

Update the data in the bank without changing the others that already exist - PDO

Hi, I am trying to create a page to change the cadastral data with mysql database, but it should only update the data that is filled and do not change the other data if they already exist in the database. I've tried a thousand ways and I can...
asked by 25.10.2017 / 15:08
1
answer

How do I check to see if a user has confirmed email with only one query?

I have 2 tables, one of users and one of confirmed emails, which has a user FK and a confirmed user bool: - tbl_valida_email ========================= fk_id_usuario usuario_confirmado I was using the following query for this: SELECT * FRO...
asked by 15.09.2017 / 02:40
2
answers

Create COLUNM with results of an account made within a ROW - MySql

Probably the title of this question is not correct, the case is that I would not know how to explain my doubt without an example. I have a scenario where I need to add the values of products that have not yet been delivered, eg: My Records...
asked by 18.07.2017 / 15:06