Posts by Daniel Omine • 19,666 points
581 posts
-
0
votes1
answer232
viewsA: Remove white bar from the top of the layout
The current version is 1.6.9.14. If you are doing a new installation, prefer the latest stable version. https://www.prestashop.com/en/download As for the "white bar" problem, it might be something…
-
3
votes3
answers271
viewsA: How to optimize SQL queries containing SELECT-related DELETE?
From what I understand you want to optimize the script and obviously the performance. It’s really not necessary to go all the way around. See an example of DELETE with JOIN. DELETE `items_rooms`…
-
7
votes4
answers2315
viewsA: How to format a value in Javascript?
If you want something generic, in which masks can be applied to various patterns <script> function format(mask, number) { var s = ''+number, r = ''; for (var im=0, is = 0; im<mask.length…
-
1
votes2
answers6303
viewsA: Build dynamic HTML table with PHP
I made a very detailed adaptation. The code looks great because of the comments, line breaks, etc. I did so to make it easy to read and understand the code. <?php /* Inicia o contador geral que…
phpanswered Daniel Omine 19,666 -
2
votes1
answer56
viewsA: What makes CURLOPT_DNS_CACHE_TIMEOUT
It is used to define the maximum lifetime of the name resolution cache in memory. For example, suppose you ran CURL to read stackoverflow.com. The IP 198.252.206.140 will be stored in memory because…
curlanswered Daniel Omine 19,666 -
2
votes2
answers99
viewsA: Keep only the last 3 backup files
<?php /* Quantidade de arquivos para manter no diretório */ $files_qty = 3; /* Diretório base */ $dir_base = dirname(__FILE__) . DIRECTORY_SEPARATOR; /* Inicia iteração no diretório */ $iterator…
phpanswered Daniel Omine 19,666 -
4
votes2
answers755
viewsA: Normalization of Mysql tables
A hint using what you posted: tb_funcionario (id_func, id_funcao, id_depto, nome_func, data_nasc, end_fun, dt_admissao, dt_demissao) tb_funcao (id_func,id_depto,nome_funcao) tb_depto (id_depto,…
mysqlanswered Daniel Omine 19,666 -
7
votes1
answer692
viewsA: Redirect all pages to HTTPS except one in particular
You can add a condition to your redirect rule for that particular address. Before the line RewriteRule, add: RewriteCond %{REQUEST_URI} !^/obrigado.php$ This way, the redirect rule is only applied…
-
1
votes4
answers958
viewsA: How to display information (domain name) using PHP?
There are many ways to solve it.. Here’s a simple example: php file with domains (dominios.php): <?php $dominio['brasil']=http://meusite.com.br; $dominio['mexico']=http://meusite.com.mx;…
phpanswered Daniel Omine 19,666 -
4
votes3
answers806
viewsA: Exchange array value when null
Another alternative is to apply a condition in the SQL query. So there would be no need to modify anything in PHP. scope IF(col_name IS NULL,"",col_name) AS col_name Practical example using part of…
-
8
votes3
answers2642
viewsA: Receive array and record multiple lines in Mysql
This is the scope for multiple inserts in Mysql: INSERT INTO NOME_DA_TABELA (COLUNA1,COLUNA2,COLUNA3) VALUES (VALOR1,VALOR2,VALOR3), (VALOR4,VALOR5,VALOR6), (VALOR7,VALOR8,VALOR9); In PHP, itere the…
-
1
votes2
answers3071
viewsA: www pointing to an ip and any subdomain to another ip
In the DNS zone would look like this: seudominio.ficticio IN A 1.2.3.4 * IN A 2.2.3.4 www IN CNAME seudominio.ficticio *I’m not considering how is the SOA and other parameters, but this is the…
dnsanswered Daniel Omine 19,666 -
4
votes4
answers10471
viewsA: How to capitalize the first letter of each word?
$str = 'LOREM IPSUM'; echo mb_convert_case($str, MB_CASE_TITLE, "UTF-8"); http://php.net/mb_convert_case
phpanswered Daniel Omine 19,666 -
0
votes2
answers1287
viewsA: Know last index of a . each
In addition to the above, since you are using Jquery, you can use the method .last() Example: var a = [1,2,3,4]; var lastEl = $(a).last()[0]; Source: https://stackoverflow.com/a/3307002/1685571…
-
0
votes3
answers259
viewsA: Fix SRC Urls by HTACCESS
An alternative is to set the tag <base> in the header of HTML pages. http://www.w3schools.com/tags/tag_base.asp Also set in httaccess the rewrite rule exception for when to find a folder or…
-
9
votes5
answers21909
viewsA: How do I check if an email actually exists?
It is quite complex because it involves various techniques. The most common technique is email with account validation link. It helps a lot but is insufficient because often email falls into the…
-
-1
votes3
answers1576
viewsA: Amazon Server Mysql Remote Access
In the my.cnf or my.ini file, specify the bind-address on a different port. port = 10002 bind-address = xxx.xxx.xxx.xxx The reason for changing the standard port is that the port 3306 may be blocked…
-
8
votes3
answers165
viewsA: What defines good logic?
What your teacher said is right, generally speaking. One problem that occurs is that some misunderstand the section "the less code the better". Then they make "spaghetti codes" to justify smaller…
algorithmanswered Daniel Omine 19,666 -
6
votes3
answers6498
viewsA: How to model a tree data structure using a relational database?
I would like to comment on the @Ernandes response, but it was a little long, so I put here as a response. I’m using Adjacent List on some systems. A drawback is the work in doing things like a…
-
2
votes2
answers151
viewsA: Where to put ; in this code
Here... ' ' do echo ' ';
phpanswered Daniel Omine 19,666 -
0
votes2
answers300
viewsA: Get link position in a menu using jQuery
In the codes you presented there is no use of Jquery UI, but only Jquery. Making a correction to the script Original: $('a').click(function(){ return false; }); $('.nav li a').click(function(){…
jqueryanswered Daniel Omine 19,666 -
0
votes3
answers901
viewsA: Infinite loop with $_SESSION and redirect
Redirect to the authentication page... That part: header("location: index.php"); Exchange for: header("location: login.php"); *login.php is an example. And of course, do not put the session check on…
-
0
votes1
answer677
viewsA: Error with controller in codeigniter named system.php
Put Codeigniter system folders and files outside the public folder (Document root) Example website/public/ website/public/css website/public/js website/codeigniter/[COLOQUE AQUI, POR EXEMPLO] After…
-
2
votes6
answers12772
viewsA: How to locate a value in an array with a specific structure
Starting with PHP 5.5.0, the new array_column() function can simplify the scripts we commonly use. print_r( array_search( '5746', array_column( $array, 'id' ) ) ); Refer to the manual:…
-
1
votes3
answers10821
viewsA: How to delete folders, subfolders and files?
Alternatively, the posted answers, you can use the Shell functions. Under Linux environment, to remove a directory and all its contents: ls | xargs rm -rf In Windows environment RMDIR…
phpanswered Daniel Omine 19,666 -
0
votes3
answers180
viewsA: It is a standard for email providers' SMTP addresses to be in the default: smtp.provedor.com?
The name of the subdomain or host is irrelevant. Just be sure to set up in the DNS zone properly as an MX zone.
-
0
votes2
answers793
viewsA: Apache directing two Urls to the same folder
In Apache 2.4, the directive Namevirtualhost went into disuse (deprecated). "IP-based Virtual Host configuration recommended": http://httpd.apache.org/docs/2.4/en/vhosts/ip-based.html Remove…
-
2
votes2
answers247
viewsA: Strange redirection
Given the circumstances, I believe it’s caused by the use of the "Multiviews" example: Options Indexes FollowSymLinks MultiViews If you don’t want to use it, just remove it Options Indexes…
-
4
votes6
answers90846
viewsA: Do I use PHP inside an HTML or an HTML inside a PHP?
Anything static, keep static. For example, an HTML page where there is no need to use a PHP database or resources, there is no reason to use PHP. Simple as that... unless you have some very specific…
-
0
votes4
answers35368
viewsA: Explanation about concatenation of variables in PHP
All this is described in the PHP manual. Making a complement, the comma can also be used as a concatenation character. In benchmark tests the use of the comma, instead of the point, is more…
-
2
votes5
answers7780
viewsA: How to use str_replace in single quotes without removing the ones that are required?
An alternative way is to select the records you want to fix. SELECT campo, ROUND ( ( LENGTH(campo) - LENGTH( REPLACE ( campo, '\'', '') ) ) / LENGTH('\'') ) AS count FROM `regexp` HAVING ( ROUND ( (…