Posts by Juven_v • 2,619 points
158 posts
-
1
votes2
answers61
viewsA: POST via AJAX is safe?
I will follow the same line as the previous answers and comments. Let’s start with this part of your question: I am trying to assemble the user registration/login part and I read that the PDO method…
-
0
votes2
answers876
viewsA: How to take out the Title Bar and adjust the screen size in Python Tkinter?
Have you tried using the method geometry to resize your screen. Something like janela.geometry('500x500'). You can see some variations of this here.…
-
0
votes1
answer136
viewsA: How can I generate an Integer number in python using Random
Along those lines np = randint(2, final-1, 1) the function randint should receive only 2 arguments, generating error during execution. Then it should be changed to np = randint(2, final-1), with…
-
2
votes1
answer91
viewsA: Open Mysql data on another page
You need to put in href of each link, page livros.php, the id of the book to be opened (display information). And receive this id on the page download.php. Something like Page livros.php <a…
-
0
votes2
answers70
views -
1
votes1
answer591
viewsA: Play next video automatically
You need the event onended of the video element to know when the video ended and be able to run the next one. Some changes to your code are needed, such as removing the attribute loop video tag,…
-
1
votes3
answers67
viewsA: Problem with select php mysql
Probably the first line of the result is being omitted because of foreach($query as $row), moving the cursor forward one position in Resultset ($query), making the fetchAll skip the first record, as…
-
1
votes1
answer654
viewsA: How to translate "Rows Selected" into datatables js
I think you want something like //..... language: { select: { rows: "%d linhas selecionadas" } } //...... More details in the documentation officer.…
-
0
votes1
answer27
viewsA: Sending form per table to the same page without refresh
One approach would be to place the div with the class modal-content in a separate file, then the ajax request would access that file, for example, modal.php, and the returned content would be…
-
1
votes1
answer121
viewsA: Table very slowly using Datatable
You need the server-side processing option offered by Datatables. Here you can see an example of server side Processing and here a class to simplify communication between Datatables and PHP.…
-
2
votes1
answer68
viewsA: How to consume validation function?
Some adaptations are necessary for your example to work the way it is organized. First its function valida() should return different things, whether or not there are errors, an example would be: php…
-
1
votes1
answer787
viewsA: Connection class mysqli in php and SELECT
I don’t think you created the statment, only then to use the prepare. Because when calling the function prepare will be returned a boolean (which results in the error you received, as a boolean…
-
1
votes1
answer1053
viewsA: Use header("Location ./") without losing form content
One approach is that the page in the action of your form, return the form itself with the presence of the error information (which fields should be modified by the user) and with the inputs filled…
-
2
votes2
answers220
views -
1
votes1
answer654
viewsA: .htaccess Internal Server Error
By placing the most Generic rule first (RewriteRule (.*) $1.php [L]) you will get an infinite loop if the file requested by the url does not exist. For example, if you request the url…
-
1
votes3
answers1959
viewsA: How do I restrict access from a page to logged in users?
You must handle some specific situations (in addition to the error shown). It means that you must put on all pages that can only be accessed after authentication, a check code to check if the…
-
1
votes2
answers155
viewsA: Logic - Knowing if you are on the second day of the month
From the day of the month (date('j')), you can find out if it is the 1st, 2nd, ..., nº (Monday to Saturday) day of the month. For this it is necessary to divide the day of the month by 7 (to see if…
-
1
votes1
answer41
viewsA: View mysql query results in Master/Detail
It is necessary to assemble an array similar to the structure you want to display. Something similar to: [ 'categoria1' => ['sub1', 'sub2', 'sub3', 'sub4'], 'categoria2' => ['sub1', 'sub2',…
-
1
votes3
answers127
viewsA: Problem in the require
In the archive usuario_class.php, on line 2, change require "../core/conecta.php" for require __FILE__ . "/../core/conecta.php". Basically the constant __FILE__ returns the directory of the file…
-
1
votes4
answers289
viewsA: Php Array - Associating data
You can make this association using the function array_combine. This function will return a new associative array from two arrays raised as parameter, where the first will be used as keys and the…
-
2
votes1
answer469
viewsA: What’s the difference between '(quotation marks) and '(quotation marks)?
You’re probably talking about a sql query made with php. Usually when you use string type values in sql query, they should be in quotes ', already numeric values do not need. Example with sql (query…
-
2
votes1
answer1366
viewsA: How to create webservice using PHP and REST?
It’s an old question but it’s worth answering. Let’s go in pieces: My doubt actually is what I need to do for my project to be considered a webservice? Usually you use webservices when you want to…
-
2
votes2
answers1039
viewsA: Add array within array
Perhaps it would be better if you return everything in the same SQL query, but as I have no details of your database do not to do so. You have some mistakes in your code. Generally to add new…
-
1
votes1
answer67
viewsA: Taking the contents of an image I made from my folder
When such doubts arise, do not hesitate to consult documentation. Basically you can use the function file, accessed from the Response object. Applying, it gets: return response()->file($url); But…
-
1
votes2
answers1993
viewsA: How to align label next to input
The @Miguel response completely answers your question. Although there may be another approach. I imagine you want both the Abels and the inputs of the same length, of course depending on the type.…
-
0
votes1
answer112
viewsA: How to consult the firebase database via an HTML or PHP page
When such a doubt arises, do not hesitate to consult taming. In it, it is usually possible to know which platforms/languages are supported. In this case, according to the guide of installation and…
-
1
votes1
answer189
viewsA: Error in 3x3 matrix
When you use the type char you can only use one character, such as 1, 2, 3, representing between single quotes, '1', '2', '3'. To make more characters you could use the type String, as an…
-
1
votes2
answers287
viewsA: How to monitor database changes without making abusive queries
One possibility would be to use sockets, that is, keep the communication channel open, to avoid making new requests (with high frequency). Although it’s tricky to use in shared hosting. Perhaps the…
-
2
votes1
answer146
viewsA: Friendship system
Consider the following table structure: create table usuario ( id int primary key auto_increment, nome varchar(50), email varchar(50), senha varchar(50) ); create table relacionamento ( de int not…
-
-1
votes2
answers4473
viewsA: Undefined variable: _SESSION
First you do a simple test. Create two files, for example, a.php and b.php, on the first boot some session variable, in the second try to access it. a.php <?php session_start();…
-
1
votes1
answer640
viewsA: Loading login data into another domain
You can use a cookie to verify that the user is logged in to the subdomino or main domain. To do this, simply create a token, save it in the database, and set it as a cookie for the browser. So…
-
0
votes2
answers273
views -
1
votes3
answers1410
viewsA: Display more than one information in the same table with PHP and MYSQL
The problem is in the while($recordCurso = mysqli_fetch_array($resultCurso)) for the resultset $resultCurso, after finishing the first student, will be on the last record. So when you arrive at the…
-
0
votes1
answer41
viewsA: Synchronize Mysql database with XLS
You have two possible approaches: use the function mysqli_affected_rows or use the clause ON DUPLICATE KEY UPDATE mysql. Using the function mysqli_affected_rows Basically, after each update, you…
-
2
votes2
answers38
viewsA: Include php with java
You are having this problem when making the ajax request: Blocked cross-origin request: Same origin policy (Same Origin Policy) prevents reading the remote resource on…
-
1
votes2
answers131
viewsA: How to improve my php pagination
You could use a plugin for paging, for example, the pagination.js. A small example of use, taken from documentation, would be so: $('#demo').pagination({ dataSource: [1, 2, 3, 4, 5, 6, 7, ... ,…
-
1
votes1
answer109
viewsA: Help with AJAX request
You must add the parameter id, passed in ajax request, to your query. One approach would be to change that line $jason = $estoque->contarProduto(); for $jason =…
-
1
votes1
answer28
viewsA: Search in BD with For Repetition
From the date you can count the number of weeks. For this you can use the class Datetime and the function format(). It is also interesting to know the values used to format. Your code can stay that…
-
1
votes2
answers120
viewsA: Retrieving database data and calculating inputs
You could use the strategy to send the data to the server, do the calculations there and return a new page. But this is definitely no longer good practice (I don’t know if it was one day), since you…
-
1
votes1
answer195
viewsA: Appear Icone from the extension as per the file extension (doc, xls, pdf)
You can create a function to return the image associated with the type of a file received as parameter. Explaining better, you create a function that takes as parameter the path to a file and…
-
2
votes1
answer162
viewsA: php insert with datetime format
Example table First let’s base the following table created in mysql: +-------------------------+ |datetime_inicio datetime | +-------------------------+ |datetime_fim datetime |…
-
1
votes1
answer1676
viewsA: How to add header and footer to mpdf
When you doubt so arise do not hesitate to look at the documentation officer. The link above has this example (that fits your needs): <?php $mpdf = new \Mpdf\Mpdf(); // Define the Header/Footer…
-
1
votes2
answers316
viewsA: Take the value of a string within a PHP variable
The @dvd response works correctly. But there is another approach that can be used with arrays. You can use the function serialize to convert from array to string (and save to database) and…
-
1
votes1
answer395
viewsA: Product Registration with Select Multiple does not insert all selected
Two things need to be fixed. First change the name attribute of the select tag to name="sabor[]" (This will allow the correct deserialization for the super global $_POST). And second, iterate over…
-
1
votes1
answer2316
viewsA: How to display the image saved in the database in my html code
A simple solution is to create a file .php to manipulate the display of your images. You can create the following url to access your images: obterImagens.php?nome=nome_da_imagem Html code for image…
-
0
votes2
answers92
viewsA: Fix Function in Calculator
When choosing a Radio field it shows the value of that field Just put the following line in the function below: $(".valores1").change(function() {…
-
1
votes1
answer43
viewsA: How to make file_exists search in the correct folder?
The comment of @Denis Rudnei de Souza is correct. However you can add a little more precision (avoid that in multiple file inclusions, the current directory accidentally changes) using the constant…
-
0
votes2
answers64
viewsA: How to include php files containing "session_start()", "echo", etc., in another php file without the "headers already sent" error?
To resolve session related error another approach can be used. Basically you create a new file, for example php session. and place the following content: //chama o session_start apenas se não tiver…
-
2
votes1
answer688
viewsA: setcookie does not work
Nothing like a minimal and reduced example. Looking at the documentation of php has two main problems that may happen. Something be printed before the call to setcookie(), causing the call to…
-
1
votes1
answer186
viewsA: Using PHP to send a reply from a form to my Email and is giving error 405 Not Allowed
In the github documentation, more specifically on What is Github Pages? it is clear that you cannot run a PHP script. Only static documents like html, css, and javascript are supported. The full…