Posts by Alisson Acioli • 5,815 points
323 posts
-
1
votes2
answers2337
viewsA: Take the value of a select and play in php variable
Face, above your doubt I will try to give you a solution without having to play in the PHP variable. The jQuery code for this would be simple: $(document).ready(function(){ $(document).on('click',…
-
1
votes0
answers35
viewsQ: jQuery does not capture custom radiobutton clicked (click)
I have a simple HTML that <input name="chave_binaria" type="radio" id="radio_39" value="1" class="with-gap radio-col-green" checked> <label for="radio_39">Esquerda</label>…
-
0
votes2
answers910
viewsQ: Catch DDD nos (11) with regex
I need to get the DDD that’s between the paretenses: (11) 9.9999-9999 I tried to make a regex but I was not successful. I will use PHP to get it, but I needed a regex for it. Could someone give me a…
-
2
votes2
answers127
viewsQ: Javascript does not take changed array before click
I have a click code: var layerMap = []; $(document).on('click', '#TipoMapa', function(){ console.log(layerMap); }); And I have a code that changes the variable layerMap: $(document).on('click',…
-
1
votes0
answers76
viewsQ: Calculate average growth percentage with PHP
I got the following json: { "bpi": { "2017-10-31": 21094.2212, "2017-11-01": 22052.8615, "2017-11-02": 22972.5023, "2017-11-03": 23730.9012, "2017-11-04": 24483.4171, "2017-11-05": 24448.8979,…
-
2
votes1
answer126
viewsQ: Get Rendered External HTML Code
I am mounting a PDF and in this PDF I have to put a graphic that is being made by Highcharts. I created an HTML and JS code by mounting the graph and it is creating it right, the problem is that I…
-
0
votes2
answers57
viewsA: Information is not enough in the value attribute
Change the function getTimeLine that you have for this: public function getTimeLine($id){ $sql = "SELECT time_line FROM posts WHERE id = '".$id."'"; $query = $this->db->query($sql);…
-
0
votes1
answer79
viewsQ: global $var does not work in PHP
I have the following code: <?php $_this =& get_instance(); function ConfiguracoesSistema($coluna){ global $_this; $configuracoes = $_this->db->get('configuracao');…
-
0
votes1
answer46
viewsQ: Cron creating files on the server
I have the controls: curl https://meusite.com/acesso/cron/cotacoes wget https://meusite.com/acesso/cron/CPTEC It performs these two commands which are responsible for saving some photos on the…
-
1
votes2
answers990
viewsA: When changing select call run query
When there is the event change in select, take the value and send via ajax: <script type="text/javascript"> // BUSCA DADOS DO CLIMA $(document).on('change', '#Cidade', function(){ let cidade =…
-
2
votes1
answer155
viewsA: How to work with IN instruction in PHP + PDO?
From what I understand your code didn’t work, correct ? Try using a name by value: $SQL = "SELECT * FROM tabela WHERE campo IN (:valor1, :valor2, :valor3)"; $Query = Database::Prepare($SQL);…
-
0
votes1
answer47
viewsA: Codeigniter Database Size 3
Do you need to count the number of records in a table or in the full database, all tables? If it is in a specific table: <?php public function conta_tabela(){ $query =…
-
0
votes2
answers975
viewsA: How to pass the value of a php variable in a javascript link within a script
I recommend you do it another way. In case you are calling the sweet alert on the same page where you define the PHP variable, so you can do so: <?php $id_teste = 10; ?> <script> swal({…
-
1
votes4
answers294
viewsQ: Replace character by PHP function
I have to make a calculation based on two things: 1 - The value that the user informs 2 - The basic account I have registered in the bank I have the base account: 5149.3074*{{INPUT}}…
phpasked Alisson Acioli 5,815 -
3
votes1
answer404
viewsA: Pick up value script Confirm and move to PHP
Yes! You can do it in 2 ways, choose the one that best suits what you want: Redirects to a PHP page by passing the Query String name var nome = prompt("Informe seu nome");…
-
0
votes3
answers4049
viewsA: Pass variable to another php file
The solution is simple, just you implement: After uploading the file you can redirect the user to the video page and to the file that has the iframe know which video is being "prompted" you use…
-
1
votes1
answer548
viewsA: Style autocomplete background
I ran some tests on the name transparent and if you assign this value it will always stay with this default color of the browser. The most recommended is you put the background color, in your case I…
-
0
votes1
answer95
viewsA: error in importing table into database
Before importing a table, check if the database was created and after it was created, click on its name (if phpmyadmin) to enter the database. After that you can import.
-
1
votes1
answer515
viewsA: View Mysql inside modal
It is possible and it is simple. For this you will use the function $.ajax() jQuery. 1 - create a list of products from the database and link the ID of each product in a link, something like:…
-
0
votes2
answers1256
viewsA: how to read the return variables using json Curl and php
Try sending your json in the format of array. Are you using the json_encode, its function is to transform an array into json, so try using the json_decode: <?php //string json contendo os dados…
-
0
votes2
answers69
viewsA: PHP Mysql Insert only works in Chrome
Try to use the code: function action_adddb () { global $db; $data = Array( 'prname' => $_POST['prname'], 'members' => $_POST['members'] ); $id = $db->insert ('users', $data); header…
-
1
votes1
answer1354
viewsA: Convert Json to Array with Jquery
Use the $.map, so transform json into array. // arquivo js $.ajax({ url: url, type: "post", data: dados, dataType: 'json', success: function(json){ let arr = $.map(json, function(el) { return el; })…
-
3
votes1
answer1659
viewsA: On-demand loading
Use the jQuery and do something like: HTML <div id="content"></div> <button id="ver-mais" data-ref="2">Carregar mais...</button> javascript //Carrega um conteúdo inicial ao…
-
0
votes1
answer38
viewsA: Error while trying to recover Mysql data with PHP
Try checking returned lines and if return more than 0 Then you take the data(s) (s) returned(s): if (isset($_POST["f_logar"])) { $user=$_POST["f_user"]; $senha=$_POST["f_senha"]; $sql="SELECT * FROM…
-
4
votes2
answers656
viewsA: Mysql query with PHP
Friend a tip I give you is never use text in fields like status. Instead, you could solve this easily using the field status as INT. Doing something like that: 0 = Não Realizado 1 = Entrega…
-
0
votes1
answer307
viewsQ: Only open prompt if you click the parent element and not the child element
I have a div and inside it has several other elements (img, span, etc.). What I need to do is only when I click on div father the prompt open javascript, if click another element (child, those…
-
6
votes1
answer285
viewsQ: Get mouse position in percentage by clicking on image
I have an image on the screen and I need to click on the image and know the position where I clicked on the X and Y of the image. For example, I clicked on the center of the image, then the X would…
-
2
votes1
answer18
viewsA: Doubt in update PHP method
You need to take the values and fill in the place on $value ? Try it like this: <?php $i = 1; $array = array('valor1', 'valor2', 'valor3'); foreach($array as $valores){ $stmt->bindValue($i,…
phpanswered Alisson Acioli 5,815 -
1
votes1
answer62
viewsA: How to add server elements
Create a variable outside the loop and then inside the loop add up with each total, and display outside the loop: session_start(); include("includes/conexa.php"); require_once 'init.php'; require…
-
1
votes2
answers44
viewsA: Make top 10 by checking 3 tables
RESOLVED I set up an SQL: SELECT u.nome, u.login, (SELECT COUNT(DISTINCT p.id) FROM patrocinadores AS p INNER JOIN cotas AS c ON c.id_user = p.id_usuario WHERE c.status = 1 AND p.id_patrocinador =…
-
1
votes2
answers44
viewsQ: Make top 10 by checking 3 tables
I have 3 tables: sponsors id | id_patrocinador | id_usuario quotas id | id_user | quantidade users id | nome | login What I need to do is a TOP 10 where I list 10 users who have more sponsored with…
-
0
votes2
answers155
viewsA: validate <form> with Javascript
If you want, you can use the plugin jQuery Validation. To use you would only have to download the plugin, call it in your HTML page and configure: <form name="ContactForm" id="ContactForm"…
-
0
votes2
answers203
viewsA: Delete button does not work
Here it takes all the Ids of the loop that you do there in modal and deletes: HTML <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"…
-
0
votes1
answer846
viewsA: Pass id received from the database through the javascript URL
Try using the Sweet Alert 2 <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/sweetalert2/6.6.0/sweetalert2.css"> <body> <?php foreach($usuario->findAll() as…
-
1
votes2
answers88
viewsA: Tags do not understand much
It would be very helpful to explain one by one. The best thing to do is to look for some tutorials CSS and HTML. This, nowadays, has a lot of content on the internet. But I will try to explain some…
-
3
votes0
answers66
viewsQ: PHP: Facebook lets me post to my feed but other users can’t get to theirs
I am creating a system of posts on facebook. I created an application and put as public. Through the application I ask for the following permissions: publish_actions manage_pages publish_pages…
-
0
votes1
answer651
viewsA: Select "select" values through "GET"
From what you said in the comments, your table structure batteries is: id_bateria products_id_product commodity manufacturer_id_manufacturer baterias_familias_id_bateria_familia modelo_battery…
-
1
votes1
answer1160
viewsA: How to select a select value and maintain after Submit with PHP
A solution would be to put the months in an array and make a loop. After giving the submit on the page check the selected month is equal to the current item of the loop and do the selected: <?php…
phpanswered Alisson Acioli 5,815 -
2
votes1
answer159
viewsA: Pick up value from a Hidden field outside the php loop
You can catch it like this: //NOME-DO-CAMPO-HIDDEN $("input[name='valorProduto']").each(function(){ if($(this).val() !== undefined){ alert($(this).val()); } });…
jqueryanswered Alisson Acioli 5,815 -
1
votes1
answer253
viewsA: Comparison of dates with strtotime
Do not even use regular expression: $data = date("Y-m-d"); //Data de Hoje $dataVencimento = '2017-03-20'; if (strtotime($data) > strtotime($data_vencimento)): echo "<font…
phpanswered Alisson Acioli 5,815 -
2
votes3
answers1527
viewsA: Connect 2 tables with same id
Whenever you need to make a relation, in the table that has the data that will relate to the user (in your case), you should have a column identifying the user ID, so you can make the relation. Then…
-
1
votes1
answer983
viewsA: Recover JSON in PHP
There are several ways to do what you need, but I’ll use your concept. In the Javascript try to send the contents of option selected as he is: function salvar(){ jQuery('#form').submit(function () {…
-
1
votes1
answer680
viewsA: fill out datatime field
If only to display from the database in the input, you can display directly, without using the DateTime <?php $date = (!empty($situacao[0]['data_inicio'])) ? date('d/m/Y H:i:s',…
-
1
votes1
answer84
viewsA: How to know how much of the content was downloaded in an Ajax request?
You have to take the functions that return you the following information: Loaded amount Total quantity to be loaded After you receive, just do the percentage calculation: (quantidade_carregada *…
-
1
votes2
answers49
viewsA: Data not saved in php database
Try to use this code: <?php $Nome = $_POST["nome"]; $Cidade = $_POST["cidade"]; $Estado = $_POST["estado"]; $Email = $_POST["email"]; $Assunto = $_POST["assunto"]; $Mensagem = $_POST["mensagem"];…
-
1
votes1
answer50
viewsQ: JS moving in variable that doesn’t have to move
I made a code that groups some items closer in one, by position x and y. The code is doing correctly, but I am facing a problem. The first time the function runs, it does all process normally. When…
-
0
votes1
answer93
viewsA: Get page information without being logged in to facebook, only by token
SOLUTION FOUND! The function request() makes various types of request to facebook. When I use the POST it is necessary to pass the parameters, thus: $query = $this->request('post', '/'.$idPage,…
-
0
votes1
answer93
viewsQ: Get page information without being logged in to facebook, only by token
I’m creating a Facebook posting system and it’s all right, except for one thing. When I drop Facebook by the system I’m doing, some functions don’t work, no matter how much I pass the access token…
-
1
votes1
answer65
viewsQ: Variable value seems not to change according to loop
I have an array and am making a loop. Within this loop I take the total size of items from each array and mount an event onmouseover displaying a tooltip with these numbers. But when I hover the…
-
0
votes1
answer111
viewsQ: Numbers are not adding up correctly
I’m doing a search on MongoDB and bringing the sum of some values. It correctly brings the values that are there, adding them up. The problem is when I need to take for example the value 1 and add…