Posts by Jhonatan Simões • 990 points
40 posts
-
-2
votes2
answers39
viewsA: Pass an array to another format
Try this: $array_meses = array(); $array_meses[1] = "Janeiro"; $array_meses[2] = "Fevereiro"; $array_meses[3] = "Março"; $array_meses[4] = "Abril"; $array_meses[5] = "Maio"; $array_meses[6] =…
-
0
votes1
answer103
viewsA: jQuery POST php mysql (mobile)
Friend, where is the test server that you are using "192.168.0.10"? If you are in your machine you will only be able to use by the browser of your machine even, probably the phone is not able to…
-
9
votes2
answers1049
viewsQ: PHP 7 already has stable version for production?
I am thinking of building a new version of the current system of my company, it is with PHP in version 5.5.9. PHP 7 already has stable version to work in production? I saw many posts on the Internet…
-
1
votes1
answer215
viewsA: file_get_contents
I made a code here and got the result: $html = file_get_contents( "https://www.google.com/finance?q=USDBRL&ei=tb1KWOHWLMX_mAGJyLnIBw" ); $content = new DOMDocument(); @$content->loadHTML(…
-
1
votes1
answer271
viewsQ: Very large select box content
I have a selectbox <select> HTML that has a very large content, are more than 1000 records that must be loaded, only that in performance issues I believe it is getting bad. I would like some…
-
1
votes5
answers21909
viewsA: How do I check if an email actually exists?
You can send a message with email validation link to the email address you entered, as soon as clicked the user is redirected to your system and the email is given as valid. There are other services…
-
2
votes5
answers259
viewsA: Login based on email domain
There is actually no safe way to ensure that the email actually belongs to the company. The failure will always be on the company’s side, because if a person who has access to DNS provides…
-
3
votes2
answers2985
viewsA: dompdf php to pdf
Hello you can wear so: $html = file_get_contents('http://www.seusite.com.br/seu_html_gigante.php'); require_once 'dompdf/autoload.inc.php'; use Dompdf\Dompdf; $dompdf = new Dompdf();…
-
2
votes2
answers146
viewsA: View report separated by date groups
Follow code, it’s quite simple, I actually generated a new array based on the initial array data <?php $data[] = array( 'data' => '2015-02-05', 'refer' => 'X741852', 'favorecido' =>…
-
4
votes1
answer102
viewsQ: Accept terms of use
What should be captured from the user when he or she clicks to accept the terms of use of my system, app or website? Usually I hear people saying that should be captured the IP and Date Time, more…
ipasked Jhonatan Simões 990 -
1
votes3
answers1212
viewsA: PHP - Comparing information
It worked for me, I went through the code: <?php $campo1 = $_POST['um']; $valor1 = 1; $msg = "erro"; if(( int ) $campo1 == $valor1){ $msg = "ok"; } echo $msg; ?>…
-
1
votes3
answers410
viewsA: Send variables to PHP via Ajax - undefined variables
The function does not find the variables, consider using global in the function <?php $servico = $_POST['servico']; $sessao = $_POST['sessao']; $user = $_POST['user']; function inclusao() {…
-
-1
votes2
answers753
viewsA: Insert HTML via jQuery (Chat)
Try it like this, using append var client = new Faye.Client('http://localhost:8000/faye'); $(function () { $('#enviar').click(function(){ var mensagem = $('#texto').val(); client.publish('/faye', {…
-
1
votes3
answers328
viewsA: How to compare encrypted data with crypt
Correct comparison if ((crypt($senha)) == $row["senha"]) { // Senhas iguais } I believe that the correct code in the comparison is this, and not crypt($senha, $row["senha"]) as asked in the…
-
2
votes1
answer299
viewsA: How to take the dimensions of an image during an upload and resize proportionally the height based on the fixed width?
Follow code using PHP GD library // Sua imagem $foto = "imagem.jpg"; $larg = 320; // largura fixa de redimensinamento $original = imagecreatefromjpeg($foto); $larg_foto = imagesx($original);…
phpanswered Jhonatan Simões 990 -
2
votes2
answers594
viewsA: Collect Google Analytics data for Mysql tables
Proposed solution: 1 . Create a column with the date of the last time you google the data from article ALTER TABLE press_i18n ADD COLUMN date_ga DATE NULL 2 . Change the script that searches all…
-
1
votes2
answers188
viewsA: Validate input to receive value with point separator with jquery?
The expression to validate this formatting is /\d*(\.\d\d)$/
-
2
votes1
answer1203
viewsA: How to make the Google map dynamic
Follows code: <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta name="robots" content="noindex, nofollow"> <meta name="googlebot"…
-
1
votes1
answer36
viewsA: How do code record information from multiple files?
The problem is how you open the file. With the w+ you open the file for read and write more puts the write pointer always at the beginning of the file. This causes you to always overwrite the file…
-
2
votes1
answer620
viewsA: Is it possible to execute multiple queries in a single run?
1 . First let’s see how your SELECT's if we use JOIN: SELECT pr.id, pr.titulo, pt.id_assunto, as.titulo FROM produtos pr INNER JOIN produtos_tem_assuntos pt ON pr.id = pt.id_produto INNER JOIN…
-
2
votes2
answers432
viewsA: How do I compare a Session?
First create the AJAX call jQuery: $.ajax({ url: "verificar.php" , success: function(result){ if(result == "NAO LOGADO"){ // Colocar mensagem bonitinha aqui... // Faz a logica para ir pro login } }…
-
3
votes1
answer762
viewsA: Best method of discovering the state
Using HTML5 and Oppenstreetmaps looks like this: navigator.geolocation.getCurrentPosition(function(posicao) { var url =…
-
8
votes3
answers14607
viewsA: How to identify which city the user is in?
Using HTML5 Geolocation and Openstreetmaps Geographic Data: navigator.geolocation.getCurrentPosition(function(posicao) { var url =…
-
1
votes3
answers838
viewsA: Uncheck a checkbox by clicking outside of it
Try it this way: $("#geral").not("#menu, #barra-icon-menu").click(function(){ $("#button-menu").prop("checked", false); $("#barra-icon-menu").click(); });
-
2
votes5
answers1021
viewsA: Pick first name with Regular Expression
This occurs due to accentuation of the word john, for the [[:alnum:]] does not consider accentuation. Consider using: preg_match('/[\p{Latin}\d]+/i', 'Joaõ da Silva', $matches); echo $matches[0];…
-
1
votes2
answers94
viewsA: With this rule below, how do I show the first and last user name in the database?
Follows code: if($this->group == User::GROUP_NOME_CLIENTE) { $nomeCompleto = $this->nome_cliente->ds_nome; $separa = explode(" ", $nomeCompleto); if(count($separa) < 2){ return…
-
4
votes1
answer53
viewsA: With this rule below, how do I show the user’s first and last names in the database?
Follows code: if(!Yii::$app->user->isGuest) { $nomeCompleto = Yii::$app->session->get('nomeUsuario'); $partes = explode(" ", $nomeCompleto); echo $partes[0] . " " .…
-
-1
votes2
answers1684
viewsA: how to get the server date with Jquery
It is possible so, put this code in javascript on the page: var variavelDataJquery = "<?=date('d/m/Y H:i:s');?>";
-
1
votes3
answers4496
viewsA: onchange Select does not work - jQuery
Try adding change with jquery: $(document).ready(function(){ $("#estado").change(function(){ alert(123); }); });
jqueryanswered Jhonatan Simões 990 -
6
votes3
answers4406
viewsA: Check empty object Angularjs
Corrected function, here worked function isEmpty(obj) { for(var prop in obj) { if(obj.hasOwnProperty(prop) && obj.prop != "" && obj.prop != undefined) return false; } return true; }…
-
1
votes2
answers196
viewsA: How to return a validated array to a form?
You can use $_SESSION, once you enter step validation saves to session: session_start(); $_SESSION["meuinput"] = "valor"; $_SESSION["meuinput2"] = "2"; session_write_close(); Dai after redirecting…
phpanswered Jhonatan Simões 990 -
1
votes1
answer134
viewsA: Show Mysql data inside Jquery
Well, see if it helps you with the proposed solution. Solution 1 ( Place javascript on your page without being in an external file ): Remove the js file from your page and enter the code below…
-
2
votes2
answers1373
viewsA: Best option to be used in error handling?
Solution using try catch try { if(!function_exists("conectar")) { throw new Exception( "Não há uma conexão ativa com o seu banco de dados!\n<br><i>Inclua a página…
phpanswered Jhonatan Simões 990 -
1
votes2
answers344
viewsA: Php does not assign value in $_SESSION
The correct order to record in PHP session is: session_start(); $_SESSION["success"] = "Produto removido com sucesso"; session_write_close(); The last command is used to save and close the Session.…
phpanswered Jhonatan Simões 990 -
3
votes2
answers516
viewsA: How to return a part of a string (an html element) in php?
See if that helps you: $data = get_content('http://www.nfe.fazenda.gov.br/portal/disponibilidade.aspx'); $dom = new domDocument; @$dom->loadHTML($data); $dom->preserveWhiteSpace = false;…
-
0
votes3
answers580
viewsA: Problem with the input click
Try to isolate jquery BIND for each input: var inputs = $('input'); $(inputs).each(function(){ $(this).on('focus', function () { var pos = $(this).offset(), posFinal = pos.top - 55;…
-
1
votes1
answer3203
viewsA: Left Join or Not Exists
The two ways are correct, but I believe that LEFT JOIN is better for not using subselect.
-
0
votes2
answers8376
viewsA: Convert a positive decimal number into negative
Multiply by -1 that the result of the multiplication is the negative number. select Valor1 * -1 AS Valor1 from TB1
-
1
votes1
answer112
viewsA: Jquery dialog not shown
Put css in div#dialog as display: None; and remove the visible="false" and test to see if it works.
-
1
votes1
answer45
viewsA: How I select all records from the table
So it takes all the rows of the table SELECT id_mark, COALESCE(a.rate, 0) AS rate, b.name_mark, b.id FROM tb_comment a, tb_mark b WHERE a.id_mark=b.id AND b.id_category=:id_c ORDER BY rate DESC…