Posts by Daniel Omine • 19,666 points
581 posts
-
0
votes2
answers97
viewsA: Can I connect to a database using JS?
In Mysql 5.7 you have the HTTP Plugin with which you can do what you want. There are other means as well, but this is the best known. The plugin is basically a REST API. Another means is using…
mysqlanswered Daniel Omine 19,666 -
0
votes2
answers369
viewsA: PHP - Function to remove character and concatenate strings (relative URL to absolute)
The appropriate term is canonize or normalize url Routine example to normalize a url: function canonicalize_url($str) { $protocol = ''; if (strpos($str, 'http://') !== false) { $protocol =…
-
1
votes2
answers812
viewsA: How to extract video ID from youtube urls?
Code removed from SO-en: if (preg_match('/youtube\.com\/watch\?v=([^\&\?\/]+)/', $url, $id)) { $values = $id[1]; } else if (preg_match('/youtube\.com\/embed\/([^\&\?\/]+)/', $url, $id)) {…
phpanswered Daniel Omine 19,666 -
1
votes3
answers394
viewsA: Data Range Search in SQL
You are formatting the date wrongly in WHERE condition. Just remove the formatting. To receive the formatted date, do this in the SELECT snippet. Example of correction: select id_venda,…
mysqlanswered Daniel Omine 19,666 -
2
votes2
answers650
viewsA: Convert to jquery
The advantage of using a framework like Jquery is reuse of cross-browser compatibility and functions. Note that many confuse Jquery as if it were a distinct Javascript language. Jquey is a framework…
-
0
votes2
answers1026
viewsA: Record record in table at each user access
In this passage $sql = "update `users` set `acesso`= acesso + 1 where id=" . App::$key; Trade for this: $sql = "update `users` set `acesso`= `acesso` + 1 where `login` = '" . $_POST['usuario'] .…
phpanswered Daniel Omine 19,666 -
4
votes3
answers5353
viewsA: Pick up input value whenever changed
Just add the value directly this way: $('meu-botao').attr('href','/busca/quantidade='+$('#quantity').val()) So you will always take the current value of the element quantity. A question, unrelated…
-
1
votes2
answers2254
viewsA: Is it possible to know where an sql execution originated in SQL SERVER?
Just enable the queries log. Then I would do the queries in the log tables of sys. Example: SELECT c.connect_time, s.login_time, s.host_name, s.login_name FROM sys.dm_exec_connections AS c JOIN…
-
9
votes7
answers22208
viewsA: Is using MD5 the safest way to encrypt passwords in PHP?
The MD5 is safe, but it is exaggerated to say that it is the best. Therefore, by responding directly, it is not the best. But it doesn’t mean you can’t use and you should change everything where…
-
1
votes2
answers953
viewsA: Point to different directory in . htaccess
A logical reason for not working if the path is correct is that the file is outside the public folder defined in Documentroot. Example, if the DocumentRoot of the site is on /site/public/html/, you…
-
2
votes1
answer1480
viewsA: Which sublime t 2/3 plugin name indicates syntax error in php language?
The most popular plugin is Xdebug https://xdebug.org/ See also use by netbeans: http://wiki.netbeans.org/HowToConfigureXDebug…
-
1
votes2
answers1450
viewsA: Mysqli does not display results
You’re invoking a non-existent method: while ($data = $query->mysqli_fetch_array()) { Correct for while ($dados = $query->fetch_array()) { Of course, it doesn’t mean it will bring the result…
-
4
votes4
answers1125
viewsA: Create external html pages
An alternative without using third-party languages like PHP, ASP, JSP, Coldfusion, Ruby, Javascript, etc., is to use web server resources. The Apache server, for example, has the module mod_include,…
html5answered Daniel Omine 19,666 -
2
votes3
answers222
viewsA: How to prevent the edge from affecting child elements
This is because the edge is added out by default. To solve, set the attribute box-sizing This will cause the edge to stay inside the element. .out, .in { width: 200px; height: 200px; border: 10px…
cssanswered Daniel Omine 19,666 -
4
votes1
answer47
viewsA: Use include or constants to pick up codes?
The question is very objective about which of the two is more performatic. Therefore, I will not comment on concepts or data structure (mvc, Oop, etc) and not even good programming practices.…
-
0
votes2
answers747
viewsA: How to find a link within an html file and switch to another link?
It is not clear because depending on what needs to be done there are various ways to solve. For example, if you just want to exchange a specific string on all links, you can use str_replace() and…
phpanswered Daniel Omine 19,666 -
5
votes1
answer68
viewsA: Variable error
Notice: Undefined variable: st in /var/www/html/questions/chk-manager.php on line 143 "Undefined variable $st on line 143" The line 143: $status=$st; The variable is being initialized within a…
-
2
votes1
answer346
viewsA: Button element submitting form. How to deactivate?
The element button is set by default to be of type Submit type="submit". Except for version earlier than IE8 where it is defined as button type="button". To disable the default type, simply specify…
htmlanswered Daniel Omine 19,666 -
3
votes1
answer501
viewsA: Best option for single data (IP, Cookies, MAC)
In the question does not specify the environment, so I will consider that you want to use in the open web environment. In this case, as you do not have administrative access to the client’s browser…
phpanswered Daniel Omine 19,666 -
1
votes3
answers1207
viewsA: Javascript Change css when you are in a particular div
Can solve with CSS only: #foo{ background-color:#ffffff; width:300px; height:80px; } #foo > .logo, #foo > .menu{ color:#000000; } #bar{ background-color:#cccccc; width:300px; height:80px; }…
-
1
votes1
answer1338
viewsA: How to Make Automatic URL in Paypal
Log in to your Paypal account and activate "Auto Return". Normally you will find in "Payment Preferences" (Selling Preferences). There is a field to enter a return URL. You can put any URL because…
apianswered Daniel Omine 19,666 -
0
votes1
answer53
viewsA: keep quantity after refresh
Just simple error of logic Suggestion for correction if ( isset($_GET['acao']) && $_GET['acao'] == 'add' ) { $id = intval($_GET['id']); if ( isset($_SESSION['shop'][$id]) ||…
phpanswered Daniel Omine 19,666 -
1
votes5
answers631
viewsA: str_split does not work well in string containing UTF-8?
Can do using the function preg_split(). A regular expression that provides greater compatibility is /(?<!^)(?!$)/u $str = 'coração da programação'; preg_split("/(?<!^)(?!$)/u", $str); I will…
-
3
votes4
answers832
viewsA: Create layout for PHP and . NET applications
The current proposal is the use of "javascript template engine". There are several frameworks like angular.js, handlebars.js, mustache.js, Jquery template, Pure.js, Dust,js, Emblem.js, marckup.js,…
-
6
votes4
answers1768
viewsA: What is the difference between ; and & in a URL?
The semicolon character ; (alias "semicolon") can be used as a parameter separator in a URL. However, the ampersand character & is the standard per general convention. The semicolon is a…
-
4
votes3
answers307
viewsA: Is there a difference in performance between "echo" content and HTML content?
All content that is static, and does not need to parse in another language independent of PHP, ASP, JSP, CGI, Ruby, dispatch as static content. In the question example, the first code needs to be…
-
10
votes4
answers2243
viewsA: Alternative to CPF (Foreign Users)
Every self-respecting country has at least one foreign control. In Brazil, control is carried out by the Federal Police. The identity document of an alien shall be: Alien Identity Card (CIE),…
-
4
votes4
answers13696
viewsA: Display message and hide in a few seconds
Teaching example: // Iniciará quando todo o corpo do documento HTML estiver pronto. $().ready(function() { setTimeout(function () { $('#foo').hide(); // "foo" é o id do elemento que seja manipular.…
-
2
votes4
answers3915
viewsA: Knowing if there are blanks
if (isset($_POST['username'])) { /** Aqui remove não somente o caracter de espaço ansi, como também o caracter de espaço multibyte, do idioma japonês. */ $str = mbstr_replace(array(' ', ' '), '',…
phpanswered Daniel Omine 19,666 -
2
votes3
answers401
viewsA: How to create Mysql search that returns lines without matching?
You can try using NOT IN() SELECT first_name, last_name FROM customer WHERE NOT IN( select first_name, last_name from customer inner join rental on customer.customer_id = rental.customer_id ); There…
-
0
votes1
answer266
viewsA: Is there any way to know how many times the function has been called?
There is a native function called debug_backtrace() With the result returned by this function, you can get the information you need. Otherwise, you would have to create a custom control. Such…
-
2
votes1
answer187
viewsA: Undefined variable although it is defined
The variable is outside the scope of the function, so the error is triggered. Two easy ways to solve: 1. Invoking a global In this passage: function FazerPostagem($idgrupos) { Add a call to global…
-
0
votes3
answers3932
viewsA: How do you configure phpmyadmin on linux?
Download and unzip the files in the directory where you want to access. Example, if you wanted to access how http://localhost/phpmyadmin, enter the folder of DOCUMENT_ROOT defined in VirtualHost…
-
0
votes3
answers83
viewsA: Date Doubt in SQL
To save date in Mysql, it must be formatted by default ISO 8601 Scope: yyyy-mm-dd yyyy -> The year represented by 4 digits mm -> The month represented by 2 digits dd -> The day represented…
-
5
votes1
answer976
viewsA: How do I make an application available only on my wireless network?
More robust routers (with more features) have DNS server option. But they are usually more expensive routers and it is not common for a home user to own. Anyway, check if the router or modem you…
-
2
votes1
answer132
viewsA: Date in odd fractional format 0.00xxxxxxx
The problem may be in this stretch Response.Write "<script>montaDataSubstituicaoPrestador(" & rsOperadora("dat_exclusao") & ")</script>" You are passing the parameter without…
-
1
votes2
answers1573
viewsA: Show real-time loop result
There are several techniques that may or may not work according to the environment. Here’s a slightly different example from the one already posted: ini_set('zlib.output_compression', 0);…
-
2
votes2
answers655
viewsA: Mysql reserved keywords
Words like default, order, name, among others, are reserved. It is allowed to use but it is necessary to escape with backsticks `default`…
-
4
votes1
answer1367
viewsA: How to group and list repeated values in array?
Example with arrays: $id2 = 'M1-c1, M1-c2, M1-c3, M1-c4, M2-c1'; $arr = explode(', ', $id2); foreach ($arr as $v) { $rs[substr($v, 0, 2)][] = substr($v, 3); } // Imprime o array (para teste)…
phpanswered Daniel Omine 19,666 -
2
votes3
answers890
viewsA: Mysql update of Empty columns only
By default, Mysql detects an existing value. If found, it does not modify it. So there is no need to make a SELECT to search where there are empty fields. You can check this on the return of…
-
2
votes3
answers1372
viewsA: How to not allow repeated INSERT by giving Reload on the page?
The simplest is to redirect to another page, however, the user can still turn the page and reprocess it. To provide a greater guarantee, raise a flag using session variable: if ($libera == "sim"…
-
1
votes1
answer97
viewsA: Error when validating data from form
On the last line of the code, add a lock key } One more detail, unrelated to the problem itself, in the main condition where it checks the $_POST with isset(): && ($_POST['especialidade'])…
phpanswered Daniel Omine 19,666 -
3
votes4
answers5900
viewsA: How to receive form data with pure HTML?
You can send and receive parameters without using server-side resources (php, Asp, ruby, etc) There is the traditional GET method way where you just read the URI and extract the parameters with…
htmlanswered Daniel Omine 19,666 -
1
votes4
answers1852
viewsA: Reference of variable
It took me years to understand why I always avoided using and also because I didn’t understand the practical use in real situations. And also because I wasn’t interested. I always saw examples with…
phpanswered Daniel Omine 19,666 -
1
votes3
answers221
viewsA: I wanted to know how to make each page refresh to . class be moved
Example with Jquery: $().ready(function() { str = ".<br>.<br>.<br>"; e = $("#content").find($("br")); p = Math.floor((Math.random() * e.length)); l = e.length - 1;…
-
8
votes1
answer443
viewsA: How do I send 200 emails (not a newsletter) without running the risk of going to spam list?
Send the authenticated emails you won’t have a problem with. In a small service I manage, more than 80,000 emails a day have been sent for more than 10 years and have never been spammed. Eventually…
-
2
votes1
answer716
viewsA: Escoder . php extension through . htaccess file
RewriteEngine On RewriteCond %{REQUEST_FILENAME}.php -f RewriteCond %{REQUEST_URI} !/$ RewriteRule (.*) $1\\.php [L] Of course this will not prevent the user from typing directly into the URL.…
-
0
votes2
answers130
viewsA: How to insert 200 new records?
Insertion containing multiple values: insert into nome_tabela VALUES ('foo 1', 'f1'), ('foo 2', 'f2'), ('foo 3', 'f3') This equals running the Insert 3 times: insert into nome_tabela VALUES ('foo…
-
1
votes2
answers121
viewsA: Create an array separated by date groups
Assign the date as the array key, like this: while ($row = $sql->fetch_object()) $data[$row['data']][] = $row; If you do not have more than one line of code in the repeat loop, you can remove the…
-
10
votes4
answers10808
viewsA: Is it possible to create a desktop application using only PHP, HTML, CSS and jQuery?
The question is about running PHP as a desktop software but at the same time comments on whether it is possible to run PHP "off the web". I understand that "outside the web" is also to be able to…