Posts by Mauro Alexandre • 1,353 points
52 posts
-
0
votes2
answers1076
viewsA: How to get value from a table column
There are already threads explaining how to do this, not specifically your problem, but as you reported that is layman in language I will explain in response. This is your code (apparently it’s…
-
0
votes1
answer107
viewsA: Mysql error: json_set does not exist
When checking the version of Mysql (5.7) in source.list and mariaDB (10.1) I realized that the packages were different (the packages of mariaDB referring to Mysql5.7+ are from 10.2). I decided to…
-
0
votes1
answer107
viewsQ: Mysql error: json_set does not exist
I am currently using Laravel to build some projects (personal); I have no experience in the framework, but a problem appeared, apparently due to MYSQL. I created a table called tabelateste and in…
-
2
votes1
answer388
viewsA: How to make a ranking in php?
The ideal is you make clear which platform you are using, because who does not play this game will not know what relates. Gesior ACC Recent versions of Gesior Acc have this sidebar indicating the…
-
1
votes1
answer282
viewsA: importing Xml data into Mysql database - Only save the LAST record
The problem lies in the logic of the application. Your variable $sql is overwriting the previous value within the repeat loop; the value stored in the variable will be the last. To solve this…
-
2
votes4
answers2757
viewsA: How to catch last word of a string in PHP?
Complemented the answers already given; there are some ways to do it, none properly "right". What can be done is to isolate and leave the most clean possible the code. The first example would be to…
-
1
votes1
answer687
viewsA: Grab mp3 link from file on Soundcloud
The way you want to do it is possible. You need to get the following URL that is located on iframe https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/328259811 You can directly…
htmlanswered Mauro Alexandre 1,353 -
3
votes2
answers175
viewsA: Input does not track col-Md-8 size
You don’t need to add a custom style, as @Ugo indicated, just add the class form-control and the very Bootstrap will apply. <link rel="stylesheet" type="text/css" media="screen"…
-
2
votes3
answers10051
viewsA: How to change the background of a CSS-only checkbox?
Currently with CSS3 you can customize a checkbox, however it is worth noting that there is no certain way to do, there are actually several methods, some cross-browser and others not. Label The most…
-
0
votes3
answers121
viewsA: Select the first result of each conversation
The query is well planned, the problem is in the organization of it. Your current query (Sqlfiddle) looks like this SELECT t1.*, m2.message, m2.from_id FROM (SELECT to_id,message, MIN(created_at) AS…
-
0
votes2
answers60
viewsA: How can I check if within one string there are others?
You can use the method indexOfto check if one of these words is located in the string passed. let palavras = ".org, .edu, .edu"; console.log(palavras.indexOf(".org")); In this example the return…
-
1
votes1
answer873
viewsA: How to display dates set in datepicker only
I do not know well the library you are using, but taking a look at the DOC I realized that it uses the same functions of Jquery UI, with some changes only. Logic Jqueryui has a property called…
-
2
votes1
answer36
viewsA: Delete two ID’s from different tables in the same query
whereas pergunta_id be a fk of the tables, you can make a INNER JOIN directly on delete. DELETE t1,t2 FROM t1 INNER JOIN t2 ON t2.ref = t1.id In this example it will delete all records where t2.ref…
-
1
votes2
answers36
viewsA: Return desirable amount
First of all, I don’t recommend using this type of model, unless for a case study. Second, even if it is for study I recommend applying some logic: Iterate only if the return is greater than one (1)…
phpanswered Mauro Alexandre 1,353 -
1
votes1
answer134
viewsA: Group similar elements of an Array in PHP
Based on your scenario, it could be something like <?php $array = array( array( "strRespAciona" => "mauro", 2 ), array( "strRespAciona" => "mauro", 1 ), array( "strRespAciona" =>…
phpanswered Mauro Alexandre 1,353 -
0
votes1
answer179
viewsA: Replace part of the URL with text
The system you want is called slug. Slug To work with Slug, it’s easy, but depends on some settings, such as URL amigável. In this example, I am creating a function that gets the title of the…
phpanswered Mauro Alexandre 1,353 -
0
votes1
answer28
viewsA: .Parent() within beforeSend
Basically, it is necessary to use var algo = $(this);, due to the scope of the operation. When you access the event scope click(), and tries to access another scope, automatically the JS will…
-
2
votes2
answers715
viewsA: Help me with a php foreach array
Being brief, PHP does not recognize the contents of $data as an object, nor as an array (referenced in foreach), for this you need to convert the string received to the correct format: $data =…
phpanswered Mauro Alexandre 1,353 -
0
votes1
answer27
viewsA: How do I count the amount of records, where equal records are grouped and equal to only one, and impose an order when showing
According to the scenario you presented, the basic query would look like this SELECT autor, count(DISTINCT time) FROM tbl GROUP BY autor See working on Sqlfiddle http://sqlfiddle.com/#! 9/7c5220/1…
phpanswered Mauro Alexandre 1,353 -
2
votes1
answer3597
viewsA: How to add the "active" class according to the page accessed
You can facilitate this work using CSS only .nav-item a:active,a:focus{ color: #188ae2; } But if you’re not yet satisfied using CSS, you can use JS $('.nav li').click(function() {…
-
2
votes1
answer24
viewsA: Link in tolls
Basically you will need to replace Regular expression ~[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]~ Implementation in PHP $texto = "Oi, sou Mauro, costumo acessar vários sites como…
-
3
votes1
answer65
viewsA: Insert array from ajax into mysql database
Basically the way you treat JS is wrong. Your code $(document).ready(function(){ $('#submit').click(function(){ var languages = []; $('.get_value').each(function(){ if($(this).is(":checked")) {…
-
1
votes1
answer75
viewsA: Check that all items are equal
What you need is to deal with for, the logic is simple Se user.status == 0 então diga "usuário pendente"; parar; senão "o usuário está em dias"; In practice it would look something like this,…
-
2
votes1
answer1210
viewsA: How to show multiple images selected "input file"?
There are some flaws in your code; in my view, the correct thing would be for you to learn how it works and redo it. Follow this explanatory code. The first logic of all is to mount html. The first…
-
1
votes1
answer553
viewsA: autocomplete="off" input type "password" is required? Why?
Some browsers implement password management; when it enters a password in the form the browser gives the option to save it, when the site is visited again, the field is auto-populated. On top of…
htmlanswered Mauro Alexandre 1,353 -
4
votes3
answers1235
viewsA: Calculate Interval of Hours
A good solution to check this is to use strtotime(); (of course) and abs(); $t1 = strtotime("18-11-2016 15:12:00"); $t2 = strtotime("18-11-2016 15:30:00"); echo round(abs($t1 - $t2) / 60,2). "…
phpanswered Mauro Alexandre 1,353 -
1
votes3
answers71
viewsA: Catch the week correctly
To add this system in PHP is simple. date('d-m-Y', strtotime("+1 week")); Using this code you will take the current date and add an extra week to it (+1 week). Accessing today, the output will be…
-
0
votes1
answer608
viewsA: Pass value $_FILES via Jquery
Yes. At the event submit of your form, through your ajax you will send the data as new FormData(this). Following example. <form name="form1" id="send" enctype="multipart/form-data"> <input…
jqueryanswered Mauro Alexandre 1,353 -
0
votes2
answers3718
viewsA: How to create a Pop UP that has the close button
First we go to the html. Create any page, index.html for example <!DOCTYPE html> <html lang="pt-br"> <head> <title>PopUp - SO</title> <meta charset="UTF-8" />…
-
1
votes2
answers2941
viewsA: Is it possible to change the browser zoom with code?
document.body.style.zoom = "200%" <p>Olá, mundo!</p> I tested this code in IE and CHROME. However I believe it is Cross-Browser.…
-
1
votes1
answer437
viewsA: What is the best database to store a list of information
The point is: Which database will I use, how structured my database is and how the application will act ? One of the main factors that impact the performance of an SQL statement is the use of…
-
4
votes3
answers463
viewsA: What is the correct option to instantiate a PHP class?
According to the official website of PHP, the instruction should be used new to instantiate a class. If you make instance of an empty generic object the best way is to use the method below: $obj =…
-
5
votes2
answers5293
viewsA: What is an Iterator?
The iterator is also known as the cursor that provides a sequential way to access the elements of a collection without exposing its internal representation. If you know that your List is an…
-
0
votes1
answer491
viewsA: CSS problem with friendly url
The best solution (depending on your application) is to use the tag base HTML5. <base href="http://seusite.com/" target="_blank"> See an example on w3schools. Another method is to get the…
-
1
votes2
answers804
viewsA: How to block all "radios" of a form when clicking a button?
You may be using also this way below Renan’s code. <button id='block'>Bloquear Formulário</button> <p><strong>1) Quantas patas tem um cachorro?</strong></p>…
-
14
votes4
answers38157
viewsA: What is XGH (Extreme Go Horse)?
Explaining better. I removed from the Helium site this example. XGH is one of the most brilliant things that has emerged in recent times, describing the stupidity that applies in agile methods, but…
terminologyanswered Mauro Alexandre 1,353 -
0
votes1
answer428
viewsA: cad_alunos.php (Student Registration Form php)
One solution is to add the novalidate in your form, since this is not one of the most recommended ways. <form class="form-horizontal" novalidate method="POST"…
phpanswered Mauro Alexandre 1,353 -
1
votes2
answers922
viewsA: Secure connection to the database
Because the methods mysql_* were deprecated in version 5.5.0 and removed in version 7.0.0. It is recommended to use PDO or mysqli. Below is an example of the use with PDO $pdo =…
-
4
votes2
answers937
viewsA: How many tables does Mysql support?
According to the Mysql documentation, there is no table or database limit. The underlying filesystem may have a limit on number of directories. Engines may have an individual value, such as Innodb…
mysqlanswered Mauro Alexandre 1,353 -
2
votes1
answer2014
viewsA: How to block user from returning to previous browser page
This script will override attempts to navigate back and forth with the current page state. history.pushState(null, null, document.URL); window.addEventListener('popstate', function () {…
javascriptanswered Mauro Alexandre 1,353 -
2
votes3
answers849
viewsA: Remote server/local server in PHP
One shared hosting already comes by default set up for you to just upload your site without worrying about setting up. The downside is that it works based on one or more servers, which host the…
-
3
votes1
answer82
viewsQ: CSS renderiza tag BODY even without the TAG
I have an HTML file which I have defined as follows <!DOCTYPE html> <html lang="pt-br"> <head> <title>Prompt</title> <meta charset="UTF-8" /> <link…
-
10
votes2
answers21331
viewsA: How to make a "back to top" button on a page?
Using Jquery //scroll normal $('html,body').scrollTop(0); //scroll suave $('html, body').animate({scrollTop:0}, 'slow'); //slow, medium, fast Using Javascript var scrollTop = function() {…
-
1
votes4
answers1129
viewsA: Last Child of Element Chain
You can use the following code var list = document.getElementById("list").lastChild.innerHTML; document.getElementById("demo").innerHTML = list; And in your HTML <ul id="list">…
javascriptanswered Mauro Alexandre 1,353 -
2
votes2
answers24947
viewsA: How to do for loop in SQL SERVER?
In the SQL SERVER there is no FOR LOOP, you must simulate it using WHILE LOOP. Basic syntax; DECLARE @cnt INT = 0; WHILE @cnt < cnt_total BEGIN {...statements...} SET @cnt = @cnt + 1; END;…
-
2
votes1
answer34
viewsA: Comparison of days (larger and smaller)
You must do something like $data1 = '2013-05-21'; $data2 = '2013-05-22'; if(strtotime($data1) > strtotime($data2)){ echo 'A data 1 é maior que a data 2.'; }elseif(strtotime($data1) ==…
phpanswered Mauro Alexandre 1,353 -
1
votes1
answer263
viewsA: How to generate images from a video?
You need to install the ffmpeg After installed use the code below. <?php $frame = 10; $movie = 'test.mp4'; $thumbnail = 'thumbnail.png'; $mov = new ffmpeg_movie($movie); $frame =…
-
4
votes2
answers1855
viewsA: Which is the best version Xampp / PHP , to update and what’s the difference?
It goes according to your need. At the moment I am using the version 5x stable. There are just a few things you should stick to. For example, in the version 7x php, some functions have been removed.…
-
1
votes4
answers6145
viewsA: Character limit in a DIV
If in the case of an input, you have two solutions: Check the amount of input characters and or leave unlimited and use the following code when the user will insert. function toLimit(string = ""){…
-
2
votes2
answers149
viewsA: PHP - How to make a GET pull a include?
It is possible yes, only you should be careful, this method is not recommended by the community. You can do it this way: function view($params = array()){ /** * @params[0] retorna nome do arquivo *…
phpanswered Mauro Alexandre 1,353