Questions tagged as 'mysql'

1
answer

How to remove HTML and Scripts in user-written messages?

I have created a messenger, and after the user writes the message it is stored in the database in varchar format, at the time the recipient sees the message, if it was written with HTML tags, and Script tags this is displayed to the recipi...
asked by 16.12.2016 / 13:35
3
answers

Repeat LEFT JOIN with other parameters in the same query

I have 2 tables: FATHER: id nome Child: id idpai sexo_filho I wanted to do a SELECT that sums up the amount of children man and women, that's the problem, I can only do with one of the sex: SELECT pai.nome, count(distinct filho.id...
asked by 02.10.2015 / 21:19
1
answer

How to fetch messages from A to B and from B to A in the same query?

I have SELECT which does almost exactly what I need, it's a chat system (inbox) similar to facebook. Then he shows me with all the contacts I have a conversation, but it brings me the last message and the date. My problem is this, if I...
asked by 17.12.2015 / 15:37
1
answer

OR returns result not expected

I'm running this function SELECT COUNT(id) FROM 'system_stats' WHERE 'name' = 1 OR 0 AND 'us_id' = 0 It returns a value equal to 1, but this 1 does not, when I execute separately in that way, it returns me 0, why with OR does it ret...
asked by 29.12.2014 / 02:20
2
answers

Return default value in mysql query

I have a query that, in certain situations, does not return a value. In this case I would like to get a value of 0, I tried to use ifnull , but without success. SELECT ifnull((valor * t1.PBRT),'0') AS C_MP FROM engenhari...
asked by 19.01.2015 / 19:53
2
answers

Local Server for Mac OSX

I bought my first week. I'm looking for a local server that ran nice on MacBook Pro, but what I use in Windows (WAMP) does not have it for Mac.     
asked by 11.03.2015 / 02:02
3
answers

Display message after MYSQL query return empty

I have a script that does a query in the database and displays the result ... I would like that when the query returned empty, a message would be displayed to the user. The code: <?php //variavel dinamica $chave = $_POST['chave'];...
asked by 27.08.2015 / 18:08
1
answer

Data grid with 0 function in the rest PHP or PHP + Ajax

I'm an Intermediate Programmer, and I'm in an Impasse, I need to display some items and what I need to fill out a prefect template. Let's explain the Logic okay? In My Table (I'll use examples ok?) ITEMS, you can add a maximum of 20 ITEMS (Up...
asked by 25.10.2014 / 22:00
2
answers

Smart Session with CodeIgniter

I have an application developed with CodeIgniter, PHP and MySQL. The user session has always been treated according to the CodeIgniter standard, but now I need the session to be more restrictive, working in a similar way to an internet banking s...
asked by 24.10.2014 / 15:12
2
answers

Pull data from db

I would like to pull the data from my db. But I do not know how to connect, it already has the configuration file, but I do not know how to pull it to use it. Connection file: <?php define('BD_USER', 'root'); // USE O TEU USUÁRIO DE B...
asked by 16.06.2015 / 01:19