Posts by Juven_v • 2,619 points
158 posts
-
3
votes1
answer52
viewsA: Form sending to the bank when updating the page
Nothing like separating things into different files. See this structure: +Projeto ---formulario.php ---salvar_formulario.php ---erro.php In the archive php form. is the submitted form: Then when the…
-
1
votes2
answers111
viewsA: Secure delivery of digital products in PHP
Defining the database Since you are using a database, you can do something easier to maintain. Imagine a table called files: +------------------------------------------+ |nome_arquivo varchar(100)…
-
1
votes1
answer97
viewsA: Update database with AJAX Switche button (Materialize)
You can send the form data to the server using the fetch api ("native" ajax). That’s the code for it: <div class="switch"> <label> Off <input type="checkbox" id="escolha"> <span…
-
3
votes2
answers770
views -
0
votes1
answer642
viewsA: Calculate speed Km/h latitude and longitude
It became half vacant where this average speed will be used. But as was margin of interpretation, I imagined the following situation: Based on the statement Every 5 minutes I go 10 kilometers per…
-
0
votes1
answer89
views -
0
votes1
answer59
viewsA: PHP update undefine
You were using a confusing structure (using two functions with the same name for different things) instead of simplifying by creating two functions with different names (although it is possible to…
-
2
votes4
answers7124
viewsA: Accept only numerics in input
So there are other ways to do it. One of them is to use input as string and reconhcer the type of value read. This can be done like this: nota = -1 while nota < 0 or nota > 10: nota =…
-
2
votes2
answers182
viewsA: Can an object be instantiated?
Let’s do a demonstration. Note the following code (I imagine it does the same thing as the example shown in the question): <?php class Objeto{ private $atributo = 'Um simples atributo'; public…
-
1
votes1
answer72
viewsA: Use a column as a header
Right after you select (something like mysqli_query(....)), you can mount a two-dimensional vector from the resultset returned by mysqli_query(). With this one can obtain a vector more or less like…
-
0
votes1
answer332
viewsA: Fill Selects based on selected item from another Select
When the user chooses an item from the select client you must make an ajax request to the server asking for the sellouts associated with the selected client id to be returned. For example, create a…
-
1
votes1
answer501
viewsA: How to correctly divide php code into mvc
Let’s go in parts. Consider the following folder structure: /projeto (raiz) Modelo Conexao.php Usuario.php UsuarioCRUD.php Visao Login.php Controle Controle.php UsuarioControle.php You will divide…
-
0
votes1
answer178
viewsA: Error 404 when entering data into database using PHP with Wampserver
Let’s go in parts. When you install wampserver (in windows) a folder is created in C:\wampserver. In that folder is a call www (C:\wampserver\www) which is equivalent to you calling the url from the…
-
0
votes1
answer38
viewsA: Configuration Wordpress Theme
The theme is probably correct. The problem relates to which page layout is selected for the home page. wordpress has some layouts, such as: front-page.php index php. page php. single php. But it may…
-
0
votes1
answer34
viewsA: How can I save the maximum value obtained in rowCount?
There are some things to consider. The multiple accesses to the function playeronline() will be made in the same http request, or in different requests from different users? Let’s see an example for…
-
1
votes1
answer1887
viewsA: Calling delete function on onclick button
Let’s split. There’s a syntax error here: <button type="button" onclick="delete(<?php echo $registro['id_tipo']; ?>" class="btn btn-danger">Apagar</button> 'Cause the parenthesis…
-
1
votes2
answers734
viewsA: Pass value of a variable from an html page to a php file
You can send data to the php script, more or less like this: $('#aumentar').click(function(){ var a= new XMLHttpRequest(); //dados a serem enviados (input com name textgol) var dados = '?textgol='+…
-
0
votes1
answer44
viewsA: How to send a Javascript array to php and display them?
A small change is missing in the field data passed as parameter to the function $.ajax: <script> var ArmazenaIds = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; $.ajax({ url:'ajaxDoEnvioMensagem.php',…
-
0
votes1
answer705
viewsA: Return SQL array in a php variable, for later HTML assembly
The problem is that the function fetch_array returns only the next line of the resultset returned in the function query(). To return all resultset lines you can use the function fetch_all(). public…
-
0
votes1
answer68
viewsA: Problems with using Ajax request
First the function fetch_assoc returns only one line of the resultset at a time. Then for all rows returned from the database to be accessed it is necessary to use a while loop to iterate over all…
-
1
votes1
answer245
viewsA: Check the Boolean return of php function in java
Following the same reasoning of @Denis Rudnei de Souza, you can read the content returned by the server (php page) following the instructions posted on github: import java.io.*; import java.net.*;…
-
3
votes2
answers107
viewsA: Doubt - Java algorithm
The problem can be solved by making an association with a matrix. Imagine a Generic matrix: a11 a12 a13 a14 a21 a22 a23 a24 a31 a32 a33 a34 a41 a42 a43 a44 Where aij, means row and column. Basically…
-
1
votes1
answer90
viewsA: Read file does not insert accents
The problem is not only the charset utf-8 that is not being set in php headers. The content read by the function readfile() is not being converted to utf-8. For this to happen some changes must be…
-
2
votes1
answer71
viewsA: I can’t get lines from the table
You had an unexpected behavior on the line document.querySelector('.end_text').innerHTML = end_novo; because this command returns only the first matching element to the selector sought (in the case…
-
0
votes1
answer43
viewsA: Help search ip
You need to put the input where you type the ip inside a form tag and then receive the value sent by this form in your php code. The code with the changes (the changes are with comments):…
-
1
votes1
answer436
views -
0
votes1
answer267
viewsA: Sum subtotal with jquery
There’s only one mistake in $('#preco_' + id).each(function () {});, because it is only executed for a single td that is in the same line of the input that was changed the quantity. I imagine you…
-
1
votes1
answer98
viewsA: Make Join with table columns where id equals variable
Problem in sql query of the function below: function stats_session(){ session_start(); if (isset($_SESSION['Login']) and isset($_SESSION['Password'])) { $data = get_user_data(); $data->execute();…
-
0
votes1
answer54
viewsA: Problem with PHP FOREACH
I took the liberty of making some changes to your code. Among them, I changed the access to the elements of the form $chave=>$valor for Object Operator ->. I also commented on both if links…
-
1
votes1
answer1345
viewsA: Using data from a $_SESSION in Javascript?
The fact that both if links are running is a mistake between the assignment operator (=) and the comparison operator (==). So just fix it to: ... ... if(nivel == 1){ ... ... ... if(nivel == 3){ ...…
-
3
votes2
answers3764
viewsA: mysqli_select_db() expects Parameter 1 to be mysqli, string Given
Correction for mysqli: $sql["host"] = "localhost"; $sql["usuario"] = "root"; $sql["senha"] = "arfito"; $sql["base"] = "digify"; $conexao = mysqli_connect($sql["host"],$sql["usuario"],$sql["senha"]);…
-
0
votes1
answer23
viewsA: I cannot display data populated in column-separated Divs
In fact there was the following problem: by placing all the contents of the while loop inside a <div class='col-md-2'>, the contents did not fit in a single "line" and broke into the next,…
-
0
votes1
answer45
viewsA: Webservice PHP does not work!
According to the question apparently you are not sending the header (from the HTTP protocol) content-type in the request to your webservice. It is necessary that in Postman you send the header…
-
1
votes1
answer42
viewsA: Doing action on all data
Like the if that checks if it exists $_POST['aceitar'] is within the while loop, regardless of the chosen offer it runs for all bank lines. One way to avoid this is to take out the ifs that check by…
-
0
votes1
answer44
viewsA: Browse and replace based on the <name> property using php
I suppose your xml file looks like this: <?xml version="1.0" encoding="utf-8"?> <places> <Placemark> <name>529383</name> <visibility>0</visibility>…
-
0
votes1
answer919
viewsA: Fill Array with variables received via POST
Assuming the inputs are repeated the same number of times you can do so: html: <form method="POST"> <div> <input name='nDup[]' type='text'> <input name='nDup[]' type='text'>…
-
0
votes1
answer192
viewsA: Search multiple PHP items database
ibase_fecth_row only returns one line at a time. If you want more than one, you can place the call from ibase_fetch_row in a loop loop, to go through all the resultset. It looks like this //........…
-
0
votes3
answers451
viewsA: Pagination in the photo gallery
I created a small control for PHP paging (optionally can be done in javascript). Basically an offset variable is used that must be passed by the url, and this variable will determine which image…
-
1
votes2
answers97
viewsA: How to get neighboring values at the given offset of an array?
I imagine if you do $offset - start + $limit + 1 should have the expected behavior. For example: $offset = 10; $limite = 3; In that case $start = 7, since $start = $offset - $limit = 7 and $end = 10…
-
2
votes3
answers968
viewsA: How to use SHA1 in login with PHP picking up parameters?
Let’s go in parts. Your query is like this: <?php $email = '[email protected]'; $password = 'senha123'; $query="select * from usuario_app where (email = '$email') AND (sha1(senha) =…
-
1
votes2
answers495
viewsA: How to adjust a div to fit across the screen if there isn’t enough content to do so
You can set the minimum height for your left bar, using the attribute min-height in class .left. To avoid overwriting of this property (by mterialize) use the !important. Example using posted code…
-
0
votes2
answers84
viewsA: Error saving Facebook profile image via PHP SDK
Imagine the following file hierarchy: / (raiz do site ou projeto) pasta1 arquivo1.php pasta_arquivos imagem arquivo2.php Now suppose the file 1.php has the following content: <?php require…
-
1
votes2
answers251
viewsA: Upload multiple images by saving only one file
Looks like you’re overwriting the array $_FILES. When you do $_FILES['files']['name'] = $_FILES['files']['name'][$i];, the amount of available Names will only be 1 (the first one assigned). You can…
-
2
votes1
answer800
viewsA: Grab the last ID when inserting into Mysql database
The problem has already been solved, but I would add a useful tip. You can cause errors in sql queries to be shown as php exceptions, allowing for faster debugging. This can be done using the…
-
0
votes1
answer142
viewsA: Register schedules in the database
This unexpected behavior happens because of the name Materias which is applied in all selects. Look at this example, which I imagine is similar to your situation: <form method="post">…
-
0
votes2
answers557
viewsA: Use PHP variable in Ajax
You could put an attribute in the input checkbox, to store the user id. Then when the checkbox was selected you would take this attribute with the jquery attr function and send it to the ajax…
-
0
votes1
answer1189
viewsA: Return Curl with JSON
The page http://consultanumero.info/consulta does not return a json object from php, instead returns in the format text/html. Then you should scroll through the returned html document, search for…
-
4
votes2
answers202
viewsA: SQL query with duplicate items
Suppose the T1 table is: id nome data_cadastro 1 joão 09/07/2017 2 maria 10/07/2017 and table T2 is: id t1_id data_sistema 1 1 09/07/2017 2 1 10/07/2017 When you do: SELECT T1.* FROM CONSULTAS T1,…
-
0
votes1
answer230
viewsA: Changing data with PDO but does not update in the database
If the data is not being updated in the database I imagine there are two possible reasons: the sql command has syntax error or the condition (Where) returns nothing (finds Matches). That supposing…
-
2
votes1
answer52
viewsA: Compare array character
By the scope of the question I created this small example: <?php $ip_1 = ['11000000', '10101000', '00000001', '00000001']; //transforma cada octeto em um array de strings $octeto1 =…