Posts by Ivan Nack • 478 points
28 posts
-
0
votes2
answers73
viewsQ: Logic optimization
I have the following logic that I need to optimize using PHP Parâmetros: máximo mínimo alerta Se ultrapassar o nível máximo enviar um alerta Se alerta já tiver sido enviado não enviar nada Se o…
-
-3
votes2
answers1277
viewsA: Calculation of hours with php
Hello As of PHP 5 >= 5.2.0, PHP relies on Datetime classes that deal with time with various functionalities. Specifically in your need Datetime::diff will help you Take a look at the…
-
2
votes1
answer871
viewsA: Download XML by browser, without opening the file
There is. Do it like this <?php header('Content-disposition: attachment; filename="file.xml"'); header('Content-type: "text/xml"; charset="utf8"'); readfile('file.xml'); ?> or <?php…
-
4
votes3
answers14234
viewsA: Remove options from select with jQuery
The last line is to work. See the example <select id="profissionalFiltro"> <option>1</option> <option>2</option> <option>3</option> </select>…
-
2
votes2
answers138
viewsQ: Remote reading on Android: Json or XML?
I’m starting on Android and also don’t have much experience in Java. My first application will have a query to a remote server. My question is this:: In Android (consequently in Java) what is more…
-
-2
votes2
answers524
viewsA: Disable Scroll with open menu
Scroll can be controlled by CSS: http://www.w3schools.com/cssref/pr_pos_overflow.asp body, html { overflow: hidden; }…
-
0
votes1
answer78
viewsA: Convert JSON to 2 string in php
The easiest way to treat json in PHP is with json_decode() and json_encode(); <?php $jsonStr = "[ [ 1455628560, 2340 ], [ 1455628620, 2340 ] ]"; $json = json_decode($jsonStr); echo "<pre>";…
-
0
votes2
answers47
viewsA: Show next value of an Array based on previously found value
This is the simplest way I’ve found: <?php $hora = date('Hi'); $os = array(1632,1635,1638,1654,1642,2200,2300,2305,2308,2310,2320,2330 ); foreach($os as $o){ // echo "<li>$o"; if($hora ==…
-
2
votes3
answers5353
viewsA: Pick up input value whenever changed
I think that way it should work: <input id="quantity" name="quantity" min="1" max="3" type="number"> <div id="divRetorno"></div> <script>…
-
0
votes2
answers286
viewsA: Validation of javascript fields?
You need to use Event.preventDefault() to stop data submission. <script> var form = document.getElementById("formulario"); form.addEventListener("submit", function(event){ var nome =…
javascriptanswered Ivan Nack 478 -
0
votes2
answers436
viewsA: Group content by month
First make a foreach in the bank query and save in an array: foreach ($dados as $reg) { $arrayDoBanco = $reg['mes'][] = $reg; } var_dump($arrayDoBanco); Then make a foreach to display the data:…
-
2
votes4
answers1750
viewsA: How to create a list of dates of the year in php, skipping the weekends?
I would do so <?php $diasDaSemana = array( 1=>'Segunda', 2=>'Terça', 3=>'Quarta', 4=>'Quinta', 5=>'Sexta', ); $inicio = DateTime::CreateFromFormat("d-m",'01-01'); $fim = clone…
-
0
votes5
answers631
viewsA: str_split does not work well in string containing UTF-8?
De php.net <?php function str_split_unicode($str, $l = 0) { if ($l > 0) { $ret = array(); $len = mb_strlen($str, "UTF-8"); for ($i = 0; $i < $len; $i += $l) { $ret[] = mb_substr($str, $i,…
-
4
votes1
answer59
viewsA: How to recover data from php terminal?
Try this: echo shell_exec("cd /home/afonso/Documentos/teste; git add arquivo.txt; git commit -m 'testando'; git push -u origin master" 2>&1"); this 2>&1 will capture everything your…
-
1
votes1
answer931
viewsA: How to do regular expression to accept words and then 2 numbers with jQuery, no special characters?
From what I understand it must solve /[^\w]/g [^\w] corresponde a um caractere único não está presente na lista abaixo \w corresponde a qualquer caractere de palavra [a-zA-Z0-9_] modificador g:…
-
0
votes1
answer49
viewsQ: Mysql table alias or clone
I have a table on MySQL that is with a wrong name, this table is already used by many applications, so it would not be very simple to rename it. Is there any way to create a alias for that table or…
-
6
votes4
answers10808
viewsA: Is it possible to create a desktop application using only PHP, HTML, CSS and jQuery?
There was a project called php-gtk, but it was decontined. GTK is a library or graphical api that provides the graphical objects widely used in linux environment, but which also has versions for…
-
0
votes3
answers897
viewsA: Search - Show Message if results are not found
See if this works: <div id="msg"></div> ..... $("#search").keyup(function(){ _this = this; // Show only matching TR, hide rest of them $.each($("#table tbody").find("tr"), function() {…
-
1
votes1
answer28
viewsA: Redistribute query results in a two-dimensional array
See if that helps you list ($usuarios,$linha,$total) = buscarTopController(); do{ $array[] = array($linha['nome'],$linha['local'], $linha['total']); }while($linha = mysql_fetch_assoc($usuarios));…
-
0
votes1
answer64
viewsA: Questions about javascript language
**url:** *url,* The first url is the name of an attribute. In your case the . form object has 2 attributes: **url:** e **onSubmit:** the url: is receiving the variable url, However, I believe that…
-
-2
votes2
answers324
viewsA: Search with Mysql PDO in Array
And if you do so: 'SELECT id, nome, caminho FROM regiao WHERE caminho IN ("itaim-bibi","jardins")' Then I wouldn’t need the blast and the implode
-
4
votes0
answers248
viewsQ: How to find the cause of discarded and error packets
My net’s a little slow today. Taking a look at the interfaces I saw that the eth1 which is the internal network there is a lot of error and scartes. ifconfig eth1 eth1 Link encap:Ethernet Endereço…
-
0
votes3
answers639
viewsA: Align 4 Ivs always horizontally, with size proportional to screen size
Look at this: .tbl { display: table; width: 100%; } .row { display: table-row; } .cel { display: table-cell; } div { border: 1px solid; } <div class="tbl"> <div class="row"> <div…
-
0
votes4
answers3189
viewsA: Access JSON with multiple JS objects
See if it clears up var json = [{ "id": 1, "nome": "Matheus Almeida Siccenna", "cpf": null, "matricula": { "id": 555, "empresa": 1, "unidade": 0, "descricaoUnidade": null, "curso": 1,…
-
0
votes1
answer100
viewsA: Form Validation - PHP
I don’t know exactly what your problem is, but the if of the mail() is duplicated. The right thing would be: if ( mail($to, $subject, $body, $headers) ) { echo "<p>Inscrição enviada com…
-
1
votes1
answer891
viewsA: Textarea function php pass data
Your doubt is confused, but answering the question: how can I be passing the value of a textarea to a php. Would that be: HTML <form action="" method=post name=f> <textarea wrap="off"…
-
3
votes3
answers11278
viewsA: How to force a PDF to be displayed in the browser
As far as I know how Pdfs are not native web pages is the browser that decides what to do with them. That is why the browser has to be configured to open using some plugin or internal viewer as in…
-
1
votes3
answers22485
viewsA: Pass php variable to javascript
It is not clear if javascript is on the same page after PHP. If it is, it is simple: <script type="text/javascript"> var autoLoad = setInterval( function () { var utilizador = "<?php echo…