Posts by Hiago Souza • 5,837 points
240 posts
-
0
votes3
answers16008
viewsA: how to update column with single quote sqlserver
Keep the quotes simple friend, make a replace for the double quotes with escape in simple so you will not have problem in SQL-Server Syntax. Example UPDATE pessoas SET nome = replace(nome, '\'',…
sql-serveranswered Hiago Souza 5,837 -
4
votes4
answers12732
viewsA: Multiple return in C/C++
Hello you can make use of vectors for this. Example int * umafuncao() { static int retorno[2]; retorno[0] = 1; retorno[1] = 2; return retorno; } void main() { int *callfunc; int a, b; callfunc =…
-
1
votes1
answer904
viewsA: Printing values with foreach in three different html <td> values
Just to use logic :) <?php $i = 1; foreach($produtos as $produto): if($i == 1) { echo "<tr>"; } ?> <td> <div class="item"> <img…
-
1
votes3
answers1676
viewsA: Use HTML5 form validation next to Jquery
Conssegui, it’s kind of a gambit but it worked! First I create the button inside the form with display none After that I put the button off and call the . click with jquery on the element I put…
-
2
votes2
answers319
viewsA: Check with IF and INNER JOIN
Try using MYSQL on, below is an example: SELECT * FROM mesas m LEFT JOIN pedidos p ON p.mesas = m.id Then just check with PHP <?php $consulta = mysql_query("SELECT * FROM mesas m LEFT JOIN…
-
3
votes2
answers3118
viewsA: Are REST and HTTP the same thing?
REST is a communication protocol, based on the HTTP hypermedia protocol. But it does not impose restrictions on the format of the message, only on the behavior of the components involved. The…
-
4
votes3
answers1676
viewsQ: Use HTML5 form validation next to Jquery
I need to validate a form using the browser property required. Only that there is a problem, my Submit button does not stay on the form. It has to stay out, and when I click on it I call the…
-
0
votes3
answers785
viewsA: file_exists php function - relative and absolute path
It works without being the absolute path however you may have problems. Example: I have a folder called a1 and inside it I have the file verifica_permissao.php In the briefcase before the a1 you…
-
0
votes2
answers97
viewsA: warning for empty in_array
You can use the Try catch block for this, so instead of you creating an array by passing null you create a treated error. Code example <?php try { $itens = $this->input->post('itens'); if…
-
1
votes2
answers517
viewsA: Function load() jQuery + Twig
To recover only a div of a content you can use AJAX to request a certain content, then recover only the info you want using the id! Follow the code below. $("body").on('click', '#menuPerfil',…
-
51
votes7
answers115219
viewsA: Mask for CPF and CNPJ in the same field
Try to use the largest operator equal to or less equal, below is an example. $("#cpfcnpj").keydown(function(){ try { $("#cpfcnpj").unmask(); } catch (e) {} var tamanho = $("#cpfcnpj").val().length;…
-
2
votes2
answers618
viewsA: Changing style of a div
Below is an example, and when id is not used getElementsById uses getElementById function handleClick(myRadio) { if (myRadio.value.localeCompare("selecteduser") === 0) {…
javascriptanswered Hiago Souza 5,837 -
15
votes1
answer21098
viewsA: Formdata() object for sending files via ajax Jquery
When retrieving the form it may return an array then take key 0 from it (if there is only one). Note: Check that the form enctype is set to "Multipart/form-data" //Exemplo do JS var formdata = new…
-
0
votes1
answer227
viewsA: Error with Jquery and html alert
First, your functions within the site variable can be executed in any context of the site. So you cannot restrict it within the $(Document). ready Below follows the code for testing Note: I…
-
1
votes2
answers175
viewsA: Take only one value from mysqli_fetch_assoc
Create a Hidden button and put the value in it: <form method="GET" action="imprimirRel.php"> <input type="hidden" value="<?php echo $func; ?>" name="submit"/> <button…
phpanswered Hiago Souza 5,837 -
1
votes1
answer971
viewsA: Restrict file access only to logged in users
First redirect all url calls to a php file to analyze it, in case we redirect everything that contains . tpl. To do this create the file ". htaccess" with the following content: RewriteEngine On…
phpanswered Hiago Souza 5,837 -
8
votes1
answer113
viewsQ: Maintain background in Drawingview
I’m needing an application to draw on a specific background, the code is working all right, but when I’m going to delete/correct a wrong line, it erases the background and the background should be…
-
2
votes2
answers381
viewsA: Reading JSON result with PHP
In the example you entered the collection2 is a vector, so as you passed an "Indice" that does not exist it will not bring the text. Note: You are also printing the wrong variable, follow below the…
-
0
votes3
answers561
viewsA: Search multiple Mysql tables
With the use of the Inner Join if one of the tables does not have the result it will not return any line. Try with the LEFT JOIN. In the Inners you have to use the condition on to determine when…
-
0
votes1
answer91
viewsA: Android app after several changes receives Sockettimeoutexception
Your connection is getting open, this may be why it works and then start giving problem. Possible causes: Check whether the Conn.Disconnect() is being triggered. Make sure your webservice is closing…
-
0
votes2
answers558
viewsA: Problem with Session variable
To make use of sessions in php you must start the session with the use of session_start(), this both on the screen that puts a value in the session and on the screen that read it follows below an…
-
1
votes2
answers501
viewsA: PHP function on an html page
Answering your question: you need to inform that the variable is global, otherwise the function will not find it. Example function mostrarCliente() { global $cliente; $cliente =…
-
4
votes5
answers409
viewsA: Today (06/30/2015) we will have a second more, what could be the consequences for our systems?
What will happen is that on the clock it will hold a second during the turn of the night. Note: The information below varies from S.O. and Programming Language. Tip: Forward your computer clock, and…
-
1
votes2
answers1486
viewsA: Compare strings to accents, UTF-8
The problem occurs because it is probably not in UTF-8 the CURL answer. For this try to convert to utf-8 before making the comparison. Functions that can be used: utf8_encode or utf8_decode Example:…
-
2
votes1
answer647
viewsA: Bootstrap changing color in print
Make use of media query classes for about writing bootstrap style Example: CSS code to handle print styles, add it between the <head></head tags> <style type="text/css"> @media…
-
4
votes5
answers2278
viewsA: Is it safe to use $_GET in PHP? (Parameter in URL)
GET / POST are methods to receive information, the GET method has never ceased to be safe, only that many people use to do sql injection, only that the SQL injection employee with any method of…
-
0
votes2
answers514
viewsA: How to consume webservice in a Chrome extension?
I indicate the use of Advanced Rest Client Rest is a great extension, helps you organize your projects. It has features to export your projects among others.…
-
10
votes3
answers387
viewsQ: How does semantics/indexing work with Angularjs?
I always wonder, Angularjs is a framework that is being used constantly. But I have a question about how it works for the crawlers (googlebot example). They even run the javascript and interpret the…
-
1
votes8
answers2805
viewsA: How to know which is the last element on a list?
I believe that using the for in place of the foreach would be easier I don’t know enough about the language so I don’t know if it’s.size() fields or.length() fields or fields. Count…
-
2
votes4
answers79
viewsA: Error in SQL like
The error is not in the like, but in the concatenation of the variable $ip Since the variable is already inside a string with double quotes vc was trying to concatenate with single quotes. Below is…
-
1
votes2
answers155
viewsA: How to modify unfilled date in the form for the current day?
First check whether the method of your form is like POST Below is an example: <form action="arquivo.php" method="post"> Data: <input type="text" name="data"/> </form> php file.…
-
1
votes1
answer1233
viewsA: Error php permission while uploading
Your php process is probably not allowed to write in the directory, go to the folder where you want to save the files and run the commands below. To find out which webserver user can use the whoami…
-
3
votes3
answers2776
viewsA: Send POST Textarea one value per line
When you retrieve this information, try using php explode to create an array and do the for. Example <?php $retorno_db = $_POST['text_area']; // Aqui coloca o valor do textarea que vai para o…
-
1
votes1
answer735
viewsA: How to compare string to accents in php
When using htmlentities you will be changing the String to "Recontrata & ccedil;& atilde;o" which when compared to "Recontreatç& atilde;o" will return you a false boolen. Try to convert…
-
5
votes3
answers2951
viewsA: json_encode returns nothing
Check that the encodings are correct, use utf8_encode to convert and test: $cidades = array(); while($row = $result->fetch()) { { $cidade = array( 'cidade' => utf8_encode($row['cidade']), );…
-
3
votes1
answer397
viewsA: Connecting a local server to an external one with js and php
How to do You can make use of Webservices, you can exchange messages (JSON). To communicate the client (local server) with the remote server (where the webservices would be next to the database).…
-
2
votes1
answer1177
viewsA: Change image upload from mysql_query to PDO
First it is necessary a connection with the PDO, follows below an example. $host="localhost"; $login="root"; // Seu login do banco de dados $senha=""; // Sua senha do banco de dados…
-
1
votes0
answers124
viewsQ: Changing ngResource save and using CORS (Cross Domain)
I’m developing an angled application, and I’m having a problem with the ngResource module. I need to call a URL from another system, for that I already added the necessary headers in the other…
-
1
votes2
answers466
viewsA: Permission problem when trying to insert an image in a PHP directory
The folders need to contain write permission from the WEB server, you probably did not give such permissions. Even if you have given 755 the apache user is probably not in the group folder, then put…
phpanswered Hiago Souza 5,837 -
0
votes2
answers1751
viewsA: Xampp - access by Android
Check on httpd.conf if within it there is a configuration Allow from :1 127.0.0.0/8 change her to Allow from All and restart your httpd server. The following question link is almost the same as…
-
1
votes1
answer2277
viewsQ: Creating dynamic ng-model with angular
I need to create a model name dynamically, but when creating obj the angular does not accept that I try to create the obj name dynamically. Has anyone ever done this or knows how to proceed? The…
-
2
votes3
answers926
viewsQ: Using find at angular
I’m studying angular and I’m in trouble. I created a directive called acao, I’m trying to get inside it the click on the element ul > li, but it doesn’t work using find and I can’t put ng-click…
-
1
votes1
answer377
viewsA: Personalized sound in Cordova Local Notification
With the plugin update the sound came back to work, I just needed to remove it and put again. Below is an example of the use: window.plugin.notification.local.add({ id: id, title: titulo, message:…
-
0
votes1
answer36
viewsA: Problem listing all images
You are always rewriting the same variable, start it and concatenate there later you print, follows below an example. // MOSTRA FOTOS DO POST $result_anexo_post = mysql_query("SELECT * FROM…
-
2
votes1
answer377
viewsQ: Personalized sound in Cordova Local Notification
I’m trying to customize the sound for a notification using the Cordova. I am using the plugin Cordova Local Notification, but the sound is not played when displaying the notification. Tests carried…
-
0
votes2
answers73
viewsA: Ignore n no with bash >>
I managed to solve, I write the file and soon after use the sed command to filter it.. follows example below php /home/usradm01/monitoringservers.php >> /tmp/err.log 2>&1 && sed…
-
1
votes2
answers73
viewsQ: Ignore n no with bash >>
Hello I have a PHP script that I run on a server, I put it in a cron. For security and maintenance reasons I write all the return of STDERR in a file, but even if the file does not return me…
-
1
votes1
answer838
viewsQ: Android Alarm / IOS with Phonegap
Good evening, I’m just developing an application for parties. In this application lists the city parties with date and time, tickets and tals.. I’m having a hard time creating a feature, I need to…
-
2
votes3
answers3392
viewsA: How to use static and global variables in PHP?
Example of use of global variables !! <?php $teste = "Variável 1"; $teste2 = "teste2"; function teste(){ global $teste,$teste2; echo $teste; // Retorno será Variável 1 } //Chamando a função…
-
2
votes1
answer333
viewsQ: Sqlitedatabase turn back into json
Good afternoon, I need to do a query but I can’t use the cursor. Example I have an object that I created that is called Databasehelper, within it I created some methods…