Posts by Edilson • 5,207 points
158 posts
-
29
votes3
answers15296
viewsQ: What is Yield for?
I’ve been writing some for some time scripts with Python, in some tutorials I am sometimes presented with the yield, that normally arises in repeat structures commonly while. What is it for? And how…
-
0
votes1
answer50
viewsA: Sum operations with sprintf
Since sprintf is a formatting function, it would not be incorrect to do: <?php $a = 1; $b = 4; $str = '%d anos menos %d = %d'; echo sprintf($str, $b, $a, $b-$a); ?> [Edit] function somar($a,…
-
1
votes4
answers1708
viewsA: Delete only selected PHP checkbox
Why don’t you organize the id in a single variable, and then run as a single query ? Another thing, you’re passing the identifier on the attribute value, is unnecessary when you already have that…
-
1
votes3
answers840
viewsA: Countdown, split time by div
O.o, I believe that this code could be much more organized and reduced. Given the problem, all you need to do is create new Divs, writing directly on html, or by linking some to the body of the page…
-
1
votes1
answer1141
viewsA: Variable with multiple lists for matrix
In the question, you exposed the problem, but you didn’t present any code, so at least I could know where you are, or what you’ve experienced. Assuming I’m not sure how you opened the file, or what…
-
6
votes4
answers4010
viewsA:  - This error appears between the <body> and gives space difference
 is a special character of html, or also, codes of ISO Latin-1, which can be placed in the source code as any other alphanumeric character, to produce characters and symbols which cannot…
-
1
votes4
answers842
viewsA: Write MYSQL data in en / UTF8 format
To set the character set in PDO you must specify in the DSN with the remaining connection parameters. ... try { $pdo = new PDO( 'mysql:host=' . DB_HOST . ';dbname=' . DB_NAME . '; charset=utf8;',…
-
1
votes1
answer285
viewsA: Show one DIV and hide another if the parameter in the url is a default parameter
For that you’d have to change your requisition for $_POST for $_REQUEST, capturing, both sent values via POST, like those sent via GET, as long as they have the word code as an index. Either way…
-
3
votes4
answers9913
viewsA: Difference between prepare() and query()?
Using the method prepare(), the values for the query are passed through parameters, which are dealt with in part by the query. Queries using this method are preferred when the desired parameters are…
-
0
votes1
answer195
viewsA: Because my LIMIT does not accept variable
Define instead the value for integer, because the clause LIMIT needs the value to be whole. $stm->bindValue( ':cont', (int) $cont, PDO::PARAM_INT); PDO::bind - PHP.net…
-
6
votes2
answers315
viewsA: filesize for files larger than 2GB on x86 platforms
It seems that, the problem occurs due to signaling that the PHP imposes on those of the type whole, and many platforms use 32 bits, reason why the filesize() sometimes returns unexpected results for…
-
2
votes1
answer29
viewsA: PHP condition with ID
For this, there is the function MIN() of SQL, that returns the smallest value, see: SELECT MIN(id) FROM tabela; For a consultation, using the PHP, you’d have something like that: $conexao = new…
-
1
votes2
answers135
viewsA: Picking wrong id when selecting line with Checkbox
To make the relation using the field id, the attribute name, that has as value checkbox[], shall have as an index the value of the id so that you can read and sign the correct values with the…
-
3
votes2
answers6584
views -
0
votes3
answers637
viewsA: Leave paging fixed using jQuery datatable
For this, just define from the own plugin, using the option scoolX, see: $(document).ready(function(){ $('#myTable').DataTable({ 'scrollX' : true }); }); For more information about the…
-
1
votes3
answers288
viewsA: How to make the content not be below the footer?
In this layout the only thing that can cause this, maybe it’s the fact that you’re defining the attributes as class (.) and then try to format as id (#). Applying a correction in the structure,…
-
1
votes2
answers462
viewsA: Search without returning PDO data
Dear friend, I don’t know if there are any more errors there, but from this bit of code you have there, I see only one irregularity capable of causing this problem, which is the number of parameters…
-
4
votes3
answers6427
viewsA: When should I use Empty or isset?
Well, for that I will select, and answer the questions one by one. In which cases, of the most common cases, I could use Empty or isset, as a way to simplify the way to check whether a value is…
-
0
votes4
answers2294
viewsA: How to return an error after sending a form?
Look, a recommendation. To set error messages, use sessions or even cookies. In addition to being viable for this task, they are easy to handle when it comes to storing and displaying simple error…
-
1
votes5
answers446
viewsA: How can I capture a favicon from a site via PHP?
Here is a very simple example, available on the PHP.net however, with some modifications, to deal with errors, and portability, for being a function. function getUrl($url){ $doc = new DOMDocument;…
-
0
votes4
answers327
views -
0
votes1
answer453
viewsA: Pass Ajax (X-Editable) data via $_POST
This happens because the X-Editable, sends the parameters as an associative array containing 3 values, and it will also have 3 different indices for each of these values, see this example below, of…
-
5
votes1
answer4635
viewsA: How to resolve a "Catchable fatal error" error
To avoid errors of the type Catchable error, should capture the exception thrown, to obtain more detailed and controlled information of the error, and exceptions sometimes make available some…
-
0
votes2
answers144
viewsA: error help . htaccess
I do not know the logic will be the same, but because there is no example of the part that contains the html from your example, I created a very simple. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML…
-
1
votes2
answers824
viewsA: PDO connection does not give error, nor with dummy bank
Based on the source that you posted on github, in this passage : $pdo = new PDO("mysql:host=localhost;dbname=angularDBB"; "root", "root", $opcoes); $opcoes = array(PDO::ATTR_ERRMODE =>…
-
2
votes2
answers612
viewsA: Doubt about white spaces within PHP code
In the PHP, can break spaces in some functions, there is no problem, for example in a array: $array = array( 'indice'=> 'Valor', 'indice1' => 'Valor' ); In this function for example, you can…
-
1
votes2
answers999
viewsA: Difficulty creating sessions to save form data
To create instances of a session, one must first initialize a session, never after, or return error. Initialize a session: session_start(); The function should always be at the beginning of the…
-
1
votes1
answer913
viewsA: Image upload does not work on the server even with full path
Use relative paths, rather than absolute paths, to traverse folders in the directory. If you have for example: -- Root - publico *uploads *admin ficheiro_responsavel_pelo_upload.php ... - privado…
-
4
votes2
answers5421
viewsA: How to validate each data type received from a form?
I will be as brief as possible, avoiding some parts theories, and exemplifying to see if it clarifies. Validating each type of data received by PHP from a form page? Validating each type of data…
-
0
votes3
answers771
viewsA: How to put two $Row results into variable?
Hi, I don’t have much time, so I’ll be brief. Your mistake is in looping, whereas you declared the beginning, but did not establish an end, or, the lines affected by that looping, see: // Obtém o…
-
5
votes3
answers1474
viewsA: How to repeat columns up to "x" of times
I know that the question has already been answered, but I will nevertheless reply and make a few observations. first Why the table structure is like this ? Since there are several users/names for…
-
1
votes1
answer920
viewsA: How to return all results from the [PDO] database?
A very simple way to do this task is by doing the following: try { $pdo = new PDO("mysql: hostname=localhost; dbname=example;", "root", ""); } catch(PDOException $e){ return $e->getMessage(); }…
-
1
votes2
answers328
viewsA: Multiple registration of image
When developing a project, or creating an auxiliary script, it is essential to be calm above all because writing code with more than 100 lines already begins to be a bit tricky at the time of…
-
4
votes2
answers2377
viewsA: Write image with php
look at this doodle here. I made the smallest changes possible. <?php class Certificado { public $nome_para_certificado = ''; public $modelo_de_certificado = ''; function __construct($nome,…
-
6
votes1
answer336
viewsA: How to pick up directories recursively?
Look, this example shows the files in layered subdirectories within the specified scope. <?php $dir_iterator = new RecursiveDirectoryIterator("../"); $iterator = new…
-
1
votes3
answers2581
viewsA: jquery datatables requested from the server with parameters
This example here uses the caixa de busca of own DataTable to perform database searches. HTML - Client <!DOCTYPE html> <html> <head> <meta charset="utf-8">…
-
1
votes2
answers1217
viewsA: User Password Validation Issue (php, mysql, crypt)
Hello, what I’m going to explain to you is no different than any other explanation about the Blowfish. function verifica_hash($password, $hash_existente){ $hash = crypt($password, $hash_existente);…
-
2
votes2
answers2675
viewsA: BD connection via php returning json to javascript
Hello, this code here worked. SQL table -- -- Estrutura da tabela `jogos` -- CREATE TABLE IF NOT EXISTS `jogos` ( `id` int(11) NOT NULL AUTO_INCREMENT, `nome` varchar(36) NOT NULL, `console`…
-
1
votes2
answers2890
viewsA: Return database data to PHP page not returning data
Hello, first of all I would like to recommend you a PHP upgrade to a recent and stable version. Nowadays almost nobody uses the MySQL because it was officially unpublished and is unsafe,…
-
7
votes5
answers667
viewsA: Use JS to relieve PHP
Hello. First of all I’m going to start by quoting a little thing that people usually say or think when they come across questions like that: Javascript despite being one of the main web languages,…
-
4
votes5
answers6496
viewsA: Does not record records in my database
Hello, honestly that was something "OMG". Your error is in the HTML form, in input de envio, you wrote something like this: <input type="submit" value="cadastrar"/> And then you tried to check…
-
1
votes2
answers128
viewsA: Empty page when running sql command
Hello. Try the following: Where do you have the mysqli_connect simply put new mysqli.
-
4
votes2
answers1580
viewsA: Security in login system
Hello, this is a "doodle" of a tutorial login system that I recently created, it is not the most complex, but it will help you understand the basics about security currently. Login &…
-
1
votes1
answer1082
viewsA: Password check with bcrypt in Session and mysql
Never, never, but never save passwords in sessions, no matter how safe your sessions may seem. To check a hash, with bcrypt, you should simply provide the first hash(hash in the database) and…
-
1
votes1
answer98
viewsA: List table data and assign value to each of them (SQL)
Hello, it would be something like that ? $sql = "SELECT id FROM personagens where id_usuario={$id_usuario_logado}"; $sql = mysqli_query($conexao_sqli, $sql); $id = ""; while($row =…
-
0
votes2
answers1028
viewsA: Problem with while loop in PDO
while(false != ($row = $fetch->fetchAll(arg))){} Try this and in case of doubt I recommend you visit the site php.net
-
1
votes3
answers1367
viewsA: How to send my login and password via $.ajax
$.ajax({ url:'link.php', username:'USR', password:'PWD', success: function(completo){ $('#resultado').html(completo); } }); Use this if the authentication is actually HTTP, otherwise set the values…
-
1
votes2
answers2263
viewsA: Calculate total "cell" average in php
Hello, I do not know if I understood your doubt well, but from what I understood this example below maybe of illuminate the way. <?php $pessoas = array( //id da pessoa => total de atendimentos…
-
5
votes2
answers3621
viewsA: Integrating Paypal Expresscheckout in PHP
The Expresscheckout is used to perform secure purchase/sales on the Paypal website and at the end of the purchase the customer returns to the site of the user or company. To understand how Paypal…
-
4
votes2
answers3621
viewsQ: Integrating Paypal Expresscheckout in PHP
for some time I have been researching how to integrate Paypal in my online stores, the ones I myself build from 0 until the final stage that is the payment, but when I went to the Paypal site to…