Questions tagged as 'php'

9
answers

How to prevent SQL injection in my PHP code?

I developed a page in PHP for internal use of the company I work with and only very few people use it. You can use this page to do some queries, insertions, changes and deletions of a table in a MySQL database, however I believe that my PHP code...
asked by 03.02.2014 / 13:37
6
answers

Why should not we use functions of type mysql_ *?

A very common question is why should we stop using mysql_ * functions? For example mysql_query() , or mysql_connect() . I see that many people use them, or stop using them but do not know the real reason. Why should they stop bein...
asked by 18.12.2013 / 12:27
2
answers

Why do you say that using @ atus to suppress errors is a bad practice?

In PHP, we can suppress errors by using arroba before certain expressions. This can be seen at: # I've seen some hangouts on PHP and staff were criticizing the use of @ in PHP, for the thesis that an error should be han...
asked by 03.09.2015 / 17:17
8
answers

Giving a "SELECT" before an "INSERT" is a safe way of not having duplicate records?

I have a table with a codigo column. I can not set it as primary key. On a system that receives many notifications before it checks with a SELECT to see if that code already exists in the table. If it does not exist it gives INS...
asked by 16.01.2014 / 16:39
4
answers

How do the date () function format a date in Portuguese?

In my project I am using the date() function, however I would like it to be in Portuguese, my current format is: "Thursday 6th", I would like it to be in the same model but in Portuguese, this is my formatting : // $article['article_tim...
asked by 06.03.2014 / 19:17
7
answers

How do I know if today's date is Saturday or Sunday (weekend) in PHP?

I want to know what is the simplest possible way to find out if today's date is Saturday or Sunday in PHP. What are the possible ways to do this?     
asked by 23.06.2016 / 19:55
3
answers

How to implement google reCAPTCHA on my site?

I'm trying to implement the reCAPTCHA of Google on my site, and I can not do the integration Server-Side (I use the PHP language). How can I make reCAPTCHA work, and do the validation before submitting my form data?...
asked by 24.04.2015 / 16:19
5
answers

How to calculate the difference between two dates?

What is the most practical way to find the time difference between two dates in the standard format used by MySQL (YYYY-MM-DD)? Ex: Date 1: 2013-12-11 Date 2: 1994-04-17     
asked by 11.12.2013 / 17:59
4
answers

What is the difference between "&&" and "||" and "and" and "or" in PHP? Which one to use?

I have this question, what is the difference between && and || and between and and or ? Which one should I use?     
asked by 22.01.2015 / 16:04
5
answers

Difference between single and double quotation marks in PHP

What is the difference between single quotes and double quotation marks in PHP? Yesterday I was working with a JSON string from google calendar I used explode('\n', .. to separate a string. When I used the explode in "Mon Jul 7,...
asked by 06.02.2014 / 20:24