Posts by dm707 • 833 points
39 posts
-
1
votes2
answers59
viewsA: PHP Personal how to list array that are with the limit less than 30 min
You need to extract string time as a whole number to compare if it is less than 30. Add this code inside the for: $tempo = filter_var($resultado['limit-uptime'], FILTER_SANITIZE_NUMBER_INT); if…
-
4
votes2
answers3540
viewsA: How to create and deploy masks for CPF, CNPJ, Data and Values?
You need three types of masks: CPF/CNPJ: function mask($val, $mask) { $maskared = ''; $k = 0; for($i = 0; $i<=strlen($mask)-1; $i++) { if($mask[$i] == '#') { if(isset($val[$k])) $maskared .=…
-
0
votes2
answers29
viewsA: Passing POST Asynchronous, array returns 0
Note that your select has the name = nome_imp and id = tabela. When you pass the post through the direct form, PHP identifies the correct name You should wear it on your jQuery: var vNome =…
-
0
votes2
answers587
viewsA: How do I check that my file type input is empty in PHP?
You can check if the size of the first entry is larger than 0, that way you’ll know if you have files to upload if ($_FILES['arquivos']['size'][0] > 0) { echo 'Contém arquivos'; } else { echo…
-
0
votes1
answer97
viewsA: User-friendly URL with more than one parameter with . htaccess php
Based on your comment, you would like to mount the url in the following structure: dominio/mdjr/controller/(id ou não), correct? And this url would point to controller.php. Could use this on…
-
1
votes2
answers67
viewsA: How to execute a function whose name was passed as a parameter of another function, à la callback?
Just remove the quotes that will work: function submitData(myCallback) { $.ajax({ success: function(res){ myCallback(res); } }); } myCallback must be able to receive the parameter passed…
-
2
votes1
answer29
viewsA: Send AJAX to a table
Note the following, you declare the table as follows: <table class="table" id="dados_entradas"> However, on the.php input page you declare again the line above, when you should only declare…
-
2
votes3
answers127
viewsA: AJAX - Appearing Ivs
There are several ways to do this, the most common would be that way: <div id="resultado" style="display:none;"></div> <script> $("#botao").click(function(){ var xprocesso =…
-
0
votes1
answer75
viewsA: Doubt IF with SQL
You’d have to do it this way: if ($_POST['busca'] == '-- Selecione o Tecnico --'){ //todos usuarios por periodo $sql = "SELECT * FROM assentamentos a, usuarios u, ocorrencias o, problemas p,…
-
2
votes1
answer1504
viewsA: How to resolve memory size error for large files generated with Dompdf?
Note the following, the error informs you that you need more than 134MB of memory to work and the most you set was 128MB. Try to put more memory and check: ini_set('memory_limit', '256M'); You also…
-
1
votes2
answers4716
viewsA: How to force HTTP access (Unsafe)
This will not be possible because it does not get to access the site files to process the redirect. The browser sends an HTTPS request to the server, failing to obtain this protocol, it sends the…
-
0
votes1
answer124
viewsA: PHP recursive directory
To work this way, the css, javascript, or image path must be relative to the page that is including the header and not the header itself. Or alternatively, you can use the absolute path to include…
-
1
votes1
answer50
viewsA: How to return the ordered value of arsort for variables?
You can do it like this: $num1 = 10; $num2 = 5; $num3 = 34; $num4 = 26; $array = array($num1, $num2, $num3, $num4); $sort = arsort($array); $nova_array = array(); $i = 0 foreach($sort as $value) {…
-
0
votes1
answer66
viewsA: Unwanted loop behavior mysql_fetch_assoc
What happens is this: you are setting javascript to a class (.request, . field). All lines have the same class. To solve it you would have to set the javascript by id (#pedido01, #field01, etc).…
-
1
votes2
answers916
viewsA: Function that returns mysqli_fetch_array
Dude, you can try doing it this way: function buscaUsuario($conexao) { $query = mysqli_query($conexao, "SELECT user_name FROM usuarios"); return mysqli_fetch_array($query) } And the other: <?php…
-
1
votes0
answers297
viewsQ: Float in DOMPDF does not work as it should
I need to use dmpdf to generate a grid of images, but the float does not work properly. Instead of him going down when he gets to the edge of the page he keeps going right. I have tried to put a div…
-
0
votes2
answers1649
viewsA: How to pull database information into a php code
If you already have select, just do the following: $linha = mysql_fetch_array($seu_select); echo "@$host = " . $linha["ip"] . "; @$port = " . $linha["porta"]; Assuming you’re using mysql_query, not…
-
1
votes1
answer390
viewsA: How to select tables by prefix [MYSQL]?
If you use phpMyAdmin, you can do this easily: Select the database > Click the export tab > Select the custom option > Find the prefix you want to export > Select the first table, then…
-
1
votes3
answers5783
viewsA: How to avoid duplicate registration in a php form
You’re creating the connection with mysqli_connect and running with mysql_query, notice the lack of i. Try to change, if it still gives error, modify your query to: $dupesql = "SELECT * FROM…
-
2
votes1
answer52
viewsA: My SQL Error in Session and query
Change the following line: while ($row = $stmt->fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_NEXT)) { To: while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { See if it works. Edited: Dude, since I don’t…
-
2
votes2
answers1939
viewsA: Php <= "value" and >= "value"?
Friend your code will always stay in the first if because to get to the else it would have to be greater than 100, and operations within the else are all less than 100, understood? First you should…
-
1
votes1
answer626
viewsA: How can I make these images slide from top to bottom and from bottom to top with jQuery?
Works like this with css, now just adapt to your code: <style> div { transition: all 0.5s ease; width: 200px; height: 200px; margin-top: 0px; background: red; } div:hover { margin-top: 100px;…
-
1
votes4
answers535
viewsA: Multiplying values within a for
Only use a multiplier for each result, since it is predefined: <?php $m = array(0, 1, 5, 16.66666666666667, 25); echo "Resultado: "; for ($loop = 1; $loop <= 4; $loop += 1) { echo ($loop *…
-
0
votes2
answers862
viewsA: PHP Calculator Table
It’s a little confusing but I think I understand. First, for multiple inputs, you put it like this: <input type="text" name="qtd[]" /> Then you recover the values again inside your while to…
-
1
votes2
answers147
viewsQ: Working with hierarchical data
I’m creating a system where administrators will set user permissions. As I want to do in an organized and very detailed way, I thought of creating permissions by groups, hierarchically, in this way:…
-
2
votes1
answer1676
viewsA: OOP PHP - Simple CRUD and Creative Block System
It is certainly useful to study MVC, I started studying and I am already developing a system based on it. I even posted a question here at the beginning because in fact it gives a big knot in the…
-
1
votes1
answer243
viewsA: DIVS move according to browser size
The problem is here: #cabecario { width: auto; height: 40px; background: #7bdac1; } Place a specific width instead of automatic, like: width: 1000px; Updating: Put it this way you’ll understand:…
-
1
votes3
answers234
viewsA: Error in Jquery pro PHP parameter crossing
Set the processData option to true: $.ajax({ url: "gerarTabelaProduto.php", type: "POST", data: { idCategoria: id }, cache: false, processData: true, success: function(data) {…
-
1
votes4
answers685
viewsA: Error in JSON PHP return to AJAX
What version of PHP? An error occurs because the function preg_replace() /and Modifier was discontinued in 5.5.x versions and must be replaced by the function preg_replace_callback(). The error…
-
1
votes2
answers1185
viewsA: How to generate value by clicking on an input type Submit
You can do it that way: <div class="alert alert-error"> <h4>Atenção!</h4> Você realmente deseja excluir o usuário: <?php echo $_GET["nome"]; echo'<br/>'; ?> <a…
-
0
votes2
answers118
viewsA: run Function
php does not work that way, with javascript you could do, but with php you need to reload the page or use jQuery AJAX Your form has to send a POST or GET with the information that php needs to…
-
2
votes3
answers228
viewsA: How to get user/visitor name and write it on the screen?
To save a name to the cookie: setcookie("nome", "Nome da Pessoa", time()+3600, "/"); To use the cookie: echo $_COOKIE["nome"]; You can set the time to as much as you want. In the example is about to…
-
0
votes1
answer58
viewsA: Dynamically consult data
In jQuery it would be more or less that: function refresh() { $.ajax({ url: "url_da_pagina.php" }).done(function (msg) { alert(msg); //aqui vc trata os dados do resultado }); }…
-
1
votes2
answers398
viewsA: Alternatives to pass data through Hidden fields
It will only be insecure if your system has security holes, otherwise the user will not be able to do anything with an ID. But if you are using a ssl certificate, for example, you can create a…
-
1
votes2
answers2883
viewsA: Run a. EXE file on Windows from a PHP application on an external server
PHP alone does not do this. The most you will get is to run through javascript: <script> function abrirArquivo() { document.location.href = "C:/Program Files/caminho/arquivo.exe"; }…
-
3
votes3
answers161
viewsA: What is the difference between these 2 PHP codes?
The only functional difference is to define whether it is public or protected. The rest is just the same organizational issue. There are people who just prefer to start the variable outside the…
-
4
votes1
answer63
viewsA: How does an e-commerce with bars e.g.: www.loja.com/meunome work, and how is the comic divided?
It’s actually simpler than it looks. When you type in store.com.br/your name, "your name" is a unique record, as if it were an ID, but easier to record and disclose (than numbers). The developer…
-
1
votes1
answer127
viewsA: How to send emails between users without limits?
I had the same problem some time ago, my server limited me to only 100 emails/hour. I decided to hire a dedicated one abroad, which is cheaper and does not limit you. Beware of free apps. Pro…
-
2
votes1
answer323
viewsQ: Good MVC practice
I’m starting a project now a bit big, and I chose to use the MVC structure. I created the entire backoffice base in a folder, but when creating it came to me the following question: Should I create…