Posts by Diego Martins • 121 points
8 posts
-
2
votes3
answers86
viewsA: Receive data from external Json and display its contents in loop as array using PHP
There are two very common errors in JSON-formatted strings, the first is in relation to the charset since the function json_decode supports UTF-8 only; the second may be string formatting error, the…
phpanswered Diego Martins 121 -
0
votes1
answer67
viewsA: Generating zip file receiving file input
Once you created the object Ziparchive and gave him a name, this file was created on the disk. At the end you invoke the function move_uploaded_file() that will take the original file and copy also…
-
1
votes2
answers327
viewsA: In PHP, does an array’s internal pointer make up its value?
One way to visualize what the internal workings of the array type are is to rely on the interface Iterator, a very simple implementation for this model would be: <?php class MyArray implements…
-
1
votes1
answer90
viewsA: How to prevent index.php main file from being deleted?
Your concern at this point is that a malicious user can delete *.php files from your site, but this leaves it open for an attacker to try to delete ANY FILE from their host, if folder permissions…
phpanswered Diego Martins 121 -
-1
votes2
answers314
viewsA: Return last entry of each product
This task may be a little more complex than it looks at first glance, so look, I’m going to put a code here just for you to do a test, I’m not a DBA experienced enough to say if this is the best…
-
1
votes2
answers712
viewsA: Subquery (SQL error (1242): Subquery Returns more than 1 Row)
An alternative solution would be to put a WHERE in place of GROUP BY subselect. SELECT a.`CPF/CNPJ`, a.Cliente, a.Cep, a.Cidade, a.Estado, COUNT(a.`CPF/CNPJ`) AS Novas_Instancias, ( SELECT COUNT(*)…
-
1
votes1
answer43
viewsA: php - add quantity + price in separate tables
Apparently his while is positioned incorrectly, whereas you have n records in the table public_cart but each record has only one product. This way makes more sense: function total_price($con) {…
phpanswered Diego Martins 121 -
1
votes2
answers162
viewsQ: How to make URL friendly without apache mod_rewrite?
I have a small project to do in the next few days and my client has a cheap, shared hosting that does not allow me to change the settings of apache and is not with mod_rewrite enabled. I would like…