Posts by Andrei Coelho • 6,196 points
249 posts
-
0
votes1
answer142
viewsA: Help - Registration Form
There are some things you can do to make sure your message is not blocked. How to prevent the message from being blocked Campo From: should be an email from your domain, otherwise you may have…
-
1
votes3
answers763
viewsA: How to enter HTML code in PHP
In addition to the other answers, which are correct, you can use the includewith the php. ... if(mysqli_num_rows($row_results) > 0){ while($results = mysqli_fetch_array($row_results)){ echo…
-
2
votes1
answer98
viewsA: Data referring to images being repeated when reading XML
In fact they are not repeating or overlapping, you who are changing the value so that it is ALWAYS the same thanks to the second foreach. To understand better take this test: <!-- codigo anterior…
-
1
votes1
answer339
viewsQ: Favicon does not work on IE
Good afternoon everyone.I’m doing some HTML layout tests. I joined IE to see how it was and noticed that the code <link rel="shortcut icon" href="img/body/icon-amova.png"/> was not working in…
-
0
votes1
answer145
viewsA: Send images to different folders and write each one to a database table using php
First you need to change this tag: <form action="" method="post"> To: <form action="" method="post" enctype="multipart/form-data"> Then you need to rescue these images and move them to…
-
0
votes3
answers1405
viewsA: How to pass a PHP variable that is inside an "a" tag to be used inside a Modal?
To redeem the values you used in a loop Therefore, you should save them in a data set called array. =) Then it would look like this: <?php ... (codigo anterior) ... //declare o array antes do for…
-
0
votes2
answers3595
viewsA: Send value from a Javascript variable to PHP
After I took a closer look at your code I noticed that you were using the jquery. There is a way you can send the js variable to php the same way you are using ajax. However, I find it easier, in…
-
1
votes1
answer449
viewsQ: How does the communication between classes work from client/user requests in MVC?
Good afternoon, I am creating my MVC framework to better understand how this structure works and what may or may not be done within it. His structure is mounted like this: From what I understand so…
-
0
votes1
answer47
viewsA: Redirect transponder at a certain time
I created a commented script for you. Are there several ways to make this code ok? This is just one example. <?php $start = "12:00";// essa é a variável que vem do banco de dados $next =…
-
5
votes1
answer1298
viewsQ: How to get the name of the current function?
Good evening. I wonder if there’s any way to get the name of the function being used, like this: public function nome_funcao(){ $nome_funcao = $this -> "nome_funcao"; } I don’t know if I was…
phpasked Andrei Coelho 6,196 -
1
votes1
answer229
viewsA: How to insert data into the database (mysql) received from an HTML form separated by commas?
If I understand your question. You want to separate this information to enter in the database. If in the textarea the information comes jumping equal line is in your example, I would do so: It would…
-
1
votes2
answers1196
viewsA: How to separate words from a string?
If as type numbered variable: $variavel0 = "valor0"; $variavel1 = "valor1"; ... I would do so: $frase = "O + rato + roeu + a + roupa + do + rei + de + roma"; $palavras = explode(" + ", $frase);…
phpanswered Andrei Coelho 6,196 -
1
votes2
answers54
viewsA: Save table values in Excel
Line 21, from what I told you, stays here: $html[$i] .= "<table>";. This error happens because this array with that key has not been declared yet, so you are concatenating an array with a…
phpanswered Andrei Coelho 6,196 -
1
votes1
answer83
viewsA: Make the form send if only certain fields are filled in
I think what you want is this: if($nome != "" && $email != "" && $emailIsValid && $telefone != ""){ ... For only if the fields $nome , $email and $telefone are empty the form…
-
0
votes0
answers662
viewsQ: Create an Image embedded in the body of the email message
Good morning to all. I created an email marketing to send to my contacts with year-end layout. Finally, I noticed the way I send the image in html: <img…
-
1
votes1
answer379
viewsA: Image histogram in PHP
Well, to make that answer, in addition to tests, I had to do some research that I’m going to show on the subject. I used the GD library, not because it was the best, but it was the first I found and…
phpanswered Andrei Coelho 6,196 -
0
votes2
answers46
viewsA: I cannot store the data in my variable database others2
You cannot store the variable $outros2 because she’s not being inserted into any of your querys. On all four querys that you created none there is the variable $outros2.…
-
1
votes1
answer79
viewsA: Create the same function in php
Use the array_map to apply a function to each element of the array, so you will check the number of characters in each element. <?php function isBigEnough($item){ if(strlen($item) > 2){ return…
-
1
votes2
answers351
viewsQ: Upload files to different servers
I have a system A which sits on a server a. And I have another system B that stays in another server B. System A needs to send files to system B. Of course if they were on the same server I could do…
phpasked Andrei Coelho 6,196 -
1
votes2
answers1168
viewsA: Query of many Mysql and PHP data
The problem is exactly what you mentioned. Multiple connections. It happens because you make these connections inside the loops. Below I exemplified, with your own code, how to fix this, because you…
-
1
votes1
answer856
viewsA: Export and Import Mysql Table
Despite the question a little vague and made my answer get big I created a solution. As you know which is the table the fields and their attributes, we will first select the records, create the…
-
1
votes2
answers2451
viewsA: Save the result of select in a variable and use this variable to fill the input that will then be used to do an UPDATE in the same table
What happens is that your form is in the same file that is posted in the database. I know this because you do not have an action in the form. This can generate some bugs as your form is always…
-
2
votes1
answer88
viewsA: Avoid using explicit loop, find/edit array with the desired value
The way this array looks is totally possible. The problem is that the more dimensions , or better, the more multidimensional the array becomes, the more complicated and complex the code becomes,…
-
1
votes1
answer898
viewsA: How do I add all the values of a PHP column
I had posted a reply but I saw that what you wanted was with PHP. I created the solution based on @William Novak’s comment to use array_sum with array_map For you to make the sum without using a…
-
1
votes1
answer836
viewsA: Single login system
Any session created by default is created a cookie in the browser called PHPSESSID that is saved the session name (in hash) created by your code in the temporary folder of the server. You can access…
-
3
votes3
answers600
viewsA: Creation of Array within Function
Another example if you need: receive a country code, search it in the array and write the country name. // abaixo mostra o array que o exercício pede para efetuar a pesquisa $paises = array(…
-
1
votes2
answers612
viewsA: Join equal records in an HTML table
With the help of the other answers, I found a solution: The way it is there, you need to sweep the valuables before giving the echo with another looping. Behold: EDITED <?php echo "<td>";…
-
3
votes2
answers305
viewsA: Vector make a mysql query
Try to do it this way: <?php // abaixo são enviados 3 produtos $produtos[0]=$_POST['produto']; $produtos[1]=$_POST['produto2']; $produtos[2]=$_POST['produto3']; // contamos a quantidade…
-
0
votes1
answer1206
viewsQ: Code for tab / window / browser tab flash
Good afternoon, as I am not good at javascript, so I need the masters here to help me. I am building a browser system for a company. In this system will happen several events, and as I wrote in the…
-
0
votes1
answer263
viewsA: Calculate the total in the bank bill
There are 2 ways to do this. With the php and with the sql. PHP <?php $conn = conecta(); $linha = Array(); // criei um array chamado totalGarel que usaremos mais tarde $totalGeral = array(); //…
-
1
votes1
answer275
viewsA: Doubt question and answer systems with $_GET method
Something very simple to solve this problem is to do the same check you did in the form within the Insert. <?php include("conexao.php"); $loja = $_GET ["loja"]; $id_usuario = $_GET…
-
1
votes2
answers606
viewsA: Save image array to different columns
Well, What little I’ve seen of this architecture of yours, I’ve found a simpler solution for you to get what you need. Since you need to enter this data into the same record, I have created a…
-
3
votes1
answer1019
viewsA: How can I make an email mask with PHP?
I created this function below because I noticed that the pattern you need wouldn’t be easy just with regular expressions. <?php function mascara($email){ // vamos separar a string em 2 partes com…
-
0
votes2
answers105
viewsA: Print results in a feed interspersed with horizontal spaces (blank line)
That should solve <?php $query = mysql_query("SELECT"); if(mysql_num_rows($query)) { ?> <p class=""> <ul class=""> <?php while($ln=mysql_fetch_array($query)) {…
-
2
votes7
answers1017
viewsA: Is there any way to know if an array is associative or sequential?
With the array_key_exists you can do this, see: // array associativo $arrayAss = array('maçã', 'numero' => 1, 'cor' => 'vermelho'); // array sequencial $arraySeq = array('maçã', 1,…
-
2
votes2
answers783
viewsQ: Clear input when user starts writing
Good afternoon, maybe there is already this answer or this question. However I did not find here or in google as I need. I found several scripts to delete the field of an html form when the user…
-
-1
votes2
answers1012
viewsA: How to list and query contacts with PHP and Javascript?
I believe that with method get becomes easy... each contact on that list is a link that goes to the same page only with an extension like this ( I am based on the url that appears in the image):…
-
0
votes4
answers535
viewsA: Multiplying values within a for
has another option... Also right <?php echo "Resultado: "; $resultado = array(); $valorInicial = 1; $valor = $valorInicial; $multiplicador = 10; for($loop = 1; $loop <= 4; $loop += 1) { $valor…
-
0
votes4
answers535
viewsA: Multiplying values within a for
I could not imagine a better application than this below because the multipliers are 1,10,5 and 2... But it worked take a look: <?php echo "Resultado: "; $resultado = array(); $valor = 1;…
-
1
votes1
answer1029
viewsA: Allow access to a PHP page only 1 user at a time
I think it’s cool to do it like this: The user who wants to be served makes a minimum registration on a form example: name and e-mail. Through the post method it is inserted into a table and…
-
0
votes1
answer1674
viewsA: Avoid date and time duplicity for the same scheduling professional
I’ve analyzed your codes, and I think you could do it in stages so you don’t have a problem with duplicity... Before the user registers name, address, etc... he has to choose 1 day that is best for…
-
1
votes2
answers237
viewsA: Error while uploading photo
I did not do the test... so I may be mistaken and take a negative.. but I think you could declare this array error before the first if.. and in each if you can use the push array_push.. probably…
-
2
votes1
answer478
viewsA: Automation of registries (Mysql)
You need to create a table in the DB called queue with the values of the users and the expected field of value 1 and 0 in order of arrival. Before the user uses his script he enters this table with…
-
1
votes1
answer830
viewsA: Display error while loading page with url not found
There are some ways you create an error page to replace the default browser error page when there is no particular file in the folder. A good option would be to create an array of pages that exist…
-
1
votes2
answers333
viewsA: Making multiple SQL inserts, multiple Inserts
You need to call the mysql query inside php to work, the way you made the $sql variable is understanding your code as a string. Come on. $sql = mysql_query("INSERT INTO endereco(id, rua, numero,…
-
2
votes1
answer1625
viewsA: Sql and PHP Friendly Url
I had the same experience with a client once. For that I did it this way and it worked: index php. $pagina = $_GET['pg']; //peguei a página.php $pagina = (isset($pagina)) ? $pagina : 'home'; //agora…
-
4
votes0
answers687
viewsQ: The time of Cookies created when I close my browser is running out
I’m here asking because unfortunately I’ve tried all the alternatives in research since last week. And I’m probably doing something wrong. Come on: setcookie("email", "email", time() + (360 * 24 *…
-
2
votes3
answers506
viewsA: User way to include new pages on a website without programming
Well, let’s see if that’s what you want... you’ll have a DB like this (+-): //tabela paginas: //(id, nome, conteudo); when he inserts a new page: //(1, galeria, conteudo1); at index you can do so:…
-
0
votes3
answers1199
viewsQ: Selection of fields that repeat in the Mysql database
I have a table in the database, with columns id, assunto, mensagem, id_replicante I want to select all records from this table. But in the field assunto has several repeating values, and I would…