Questions tagged as 'php'

4
answers

Permission error when trying to access database [closed]

   Error: SQLSTATE [28000] [1045] Access denied for user 'root' @ 'localhost'   (using password: YES)     
asked by 06.02.2014 / 21:19
2
answers

How do I not cache image cache with HTML or PHP?

I'm creating a web page that is almost just image, every day I change the images of the page but their name remains the same. The browser is caching a lot and every time I update the images they do not change visually if you have already accesse...
asked by 13.06.2014 / 16:17
2
answers

Search returns equal data

I'm doing a search system where you have some fields (conditions) to search and find the results. These fields are not mandatory, in case the person type something he will find the data entered, in case the person does not type, the system will...
asked by 15.09.2014 / 11:56
4
answers

Interpretation of repetition loop

I'm having trouble understanding the following code that is presented as a book exercise. $a = true; $b = -2; $c = 7; for ( ; $b < $c || $a; $b++){ if ($c + $b * 2 > 20) $a = false; echo $b." "; } The result is: -...
asked by 10.10.2018 / 00:58
3
answers

Last position of an Array

In PHP, what's the fastest and easiest way to get the last position of an Array? I got this doing $array[ count($array) - 1 ] , and it works, but is there any simpler and less ugly way?     
asked by 23.04.2014 / 21:53
2
answers

How to set date ('d / m / Y H: i: s') with Brasília time instead of server time

I'm writing the date and time in the database with script : $sql = "INSERT INTO admin_users (user_name, user_password_hash, user_email, user_data) VALUES('" . $user_name . "', '" . $user_password_hash . "', '" . $user_...
asked by 11.02.2015 / 17:27
2
answers

Foreach inside foreach

I need to execute a foreach within another foreach in PHP. But it returns me the following error:    Parse error: syntax error, unexpected T_FOREACH referring to the line where the second foreach occurs Here's part of the...
asked by 02.04.2015 / 20:29
3
answers

How to convert the first letter of each word to upper case?

I would like to manipulate the way the person types the name when registering, to be left with only the first letter of the name in the upper case. The examples I found do not do exactly what I need. In my case, if the person types: joão...
asked by 10.09.2014 / 15:22
3
answers

Search word with file_get_contents

How can I use file_get_contents to search for the word "team" in the site and if it finds the word echo the word? <?php $content = file_get_contents( 'https://www.hostgator.com.br' ); $busca = 'equipe '; ?>     
asked by 17.11.2015 / 20:48
5
answers

How to concatenate String within a loop of repetition?

I need to add some values in a string . How do I concatenate values in a string with a loop of repetition. Example: for($c=0; $c < $tam; $c++){ //concatenar sempre o valor $minhastring = $valor[$c].','; } That is, I need...
asked by 22.09.2015 / 13:43