Posts by caiocafardo • 1,897 points
132 posts
-
1
votes1
answer149
viewsQ: Position Absolute does not occupy 100% of the father
Why does a div with Absolute position not occupy 100% of the father’s width if it fits, why breaks the line before? See example below: .segura{ width: 200px; height: 200px; display: block; position:…
-
2
votes2
answers1015
viewsQ: Why margin-top affects the father div
Because when I give a margin-top on the child element it affects the parent element? See example below: body{ background-color: #aaaaaa; } .topo{ width: calc(100% - 20px); max-width: 1200px; height:…
-
3
votes4
answers238
viewsQ: Variable feed within variable
In JS I have the following line: var recebeMensagem = ''; var mensagemBot = '<div class="bot_mensagens">'+recebeMensagem+'</div>'; // 1ª mensagem recebeMensagem = 'Olá';…
-
1
votes1
answer258
viewsQ: In jquery write a different link in a href
I have this HTML snippet that is called on some screens when necessary (clicking it opens an iframe inside the HTML): <a href="#" class="tour-360" id="tour-360-{{unit.hash}}" data-toggle="modal"…
-
1
votes1
answer130
viewsQ: Make INNER JOIN on two different bases
I have 2 different Mysql databases, I can make a query on one basis or another specifying which connection I will use so: $result1 = mysql_query($sql1, $banco1); $result2 = mysql_query($sql2,…
mysqlasked caiocafardo 1,897 -
2
votes1
answer28
viewsA: Load decimal configured data
Using toFixed: var numero = 3; var numeroMuda = numero.toFixed(2); // coloca duas casas decimais alert(numeroMuda); // vai dar 3.00 mas se quiser é só alterar o . por , usando…
-
1
votes4
answers360
viewsA: How do I remove characters from a string to a certain extent? in PHP
Using the explode: $string = "142-22"; // da um explode usando o - como separador $stringSeparada = explode("-", $string); // a $stringSeparada vira uma array, e i primeiro elemento dessa array é a…
-
1
votes3
answers41
viewsQ: Do not show element that has a certain value
In Mysql I have a table called user where all website users are stored: ID | NOME 1 | bla 2 | ble 3 | bli 4 | blo And a table called user_management, where are fields related to managing these…
mysqlasked caiocafardo 1,897 -
0
votes1
answer54
viewsQ: Transform string into array excluding repeated values
In PHP I made a script that takes each word of a Tring and turns them into an array, giving explodes into empty spaces. Then he eliminates the repeated words and shows each of them, like this:…
-
0
votes3
answers49
viewsA: Resume counting if you exceed options
$(function(){ //cria uma variavel para saber qual a contagem var contador = 0; $("#adicionar").on("click",function(e){ // alimenta + 1 na variável; contador ++; // se…
-
1
votes1
answer93
viewsA: Browser Guide / Title Blink when Reaching Given Time
Using setInterval would solve your problem, remembering that most browsers do not accept the empty page title: $(document).ready(function() { // cria uma variável para checar quando entra o título e…
-
0
votes1
answer293
viewsQ: Select com group by duplo
In Mysql I have a table called contact_status: id | id_contato | detalhamento_id 1 | 1 | 2 2 | 1 | 3 3 | 2 | 4 4 | 2 | 2 5 | 2 | 1 6 | 3 | 2 7 | 4 | 4 8 | 5 | 4 In it is recorded all the contacts of…
-
0
votes1
answer1295
viewsQ: Phpmailer + gmail
I am using the latest version of Phpmailer to fire e-mail using my Gmail account, this application runs locally, below my code (copied from Phpmailer’s own Github talking about sending to Gmail):…
-
0
votes1
answer573
viewsQ: Mysql SELECT with ORDER BY no GROUP BY
I have a table called contacts, all contacts made on the site are registered on it. There is also a table called status, where the service status of each is stored contact. The question, I need to…
-
0
votes1
answer65
viewsA: Group dates that are in Mysql in PHP
I ended up getting, maybe it is not the ideal and most effective way, but it worked, follow the code commented, if you have doubts just ask: $sql = $pdo->prepare('SELECT…
-
1
votes1
answer65
viewsQ: Group dates that are in Mysql in PHP
I have a Mysql table called apartamento_data, in it there are dates that the apartment is rented, ie unavailable for rent. Each line a date, so: 2017-05-31 2017-06-01 2017-06-04 2017-06-05…
-
0
votes3
answers99
viewsQ: Take data that is not in the table
In Mysql I have a table login, that shows who logged on to the system: id | cod_usuario After the site is ready and running the client passed me a list of cod_usuario that CAN log into the system,…
mysqlasked caiocafardo 1,897 -
1
votes0
answers285
viewsQ: How to unset a coockie when closing the browser
In PHP I am creating a login coockie like this: $data = "e".gmdate("dmY"); setcookie("elogado", $data, time() + 600, "/"); When I close the browser and reopen, will I check the coockie like this:…
-
0
votes2
answers54
viewsQ: Select only if the ID is in 2 tables
I have 2 tables in Mysql, INSCRICAO1 and INSCRICAO2. Both have a field called COD that receives a user code. To INSCRICAO1 stores your personal information To INSCRICAO2 saves user’s car information…
-
1
votes1
answer63
viewsQ: Show div to scrolar the page?
I see many Wordpress themes use the feature to show the elements as you scroll on the site, an example is this: https://belle-demo.myshopify.com How is this done? Only with CSS is it possible?…
-
0
votes1
answer116
viewsQ: Changing the Mysql version
I have this table in Mysql called logou: id | idconta | dia This query in Mysql always worked on my server: SELECT dia FROM logou GROUP BY YEAR(dia), MONTH(dia) ORDER BY dia DESC But now that the…
mysqlasked caiocafardo 1,897 -
3
votes1
answer1072
viewsQ: Transparenet beveled edge with css only
There is a simple way to make a beveled edge with CSS only, but transparent. No need for svg, png, etc? Look what I’ve done so far: https://jsfiddle.net/Cafardo/zn5oysqy/5/ .home_fundo{ width:…
-
1
votes1
answer49
viewsQ: LEFT JOIN count likes
I have the following tables in Mysql (it is more complex than the example, I simplified): CURSO: id | nome CURTIDA: id | id_curso Every time someone enjoys a course, feeds the table LIKES Now, when…
mysqlasked caiocafardo 1,897 -
0
votes2
answers313
viewsQ: Detect click over an iframe
I have an iframe: <div class="recebe_iframe"> <iframe class="caixa_iframe" src="https://www.youtube.com/embed/dfsdfsdf" frameborder="0" allowfullscreen></iframe> </div>…
-
1
votes1
answer122
viewsQ: htaccess redirect 301 URL that does not exist
There was an old site and all its Urls were changed. A URL that was well found in Google was: meudominio.com/datacenters Now I want to redirect this URL to: meudominio.com/data-centers In htaccess I…
-
0
votes1
answer57
viewsQ: Similar rewriterule problems in htaccess URL
I have two Urls http://localhost/odata/contact http://localhost/odata/en They are different URL that lead to different . php files, so I did my htaccess: RewriteRule ^entre-em-contato…
-
0
votes0
answers60
viewsQ: crypt without the use of salt
There is a system in PHP that was not developed by me, it uses crypt to encrypt the user’s password, thus: $senha = crypt($senha); With the PHP update on the server, crypt is asking for a salt when…
-
3
votes1
answer56
viewsQ: User see current version of Jquery and CSS without cache
Every time I update the CSS and JQUERY from a website, I need to keep asking the customer to open the site in an anonymous window. Because his browser saves the old files and he can’t see the…
-
1
votes4
answers114
viewsA: Ajax does not recognize PHP echo
The error was what they were talking about, some empty space was coming from PHP. I was able to adjust using Jquery’s Trim: jQuery.Trim() Thus remaining: if($.trim(resposta) == '<nome>'){…
-
1
votes4
answers114
viewsQ: Ajax does not recognize PHP echo
I have a simple ajax: $.ajax({ url:"php/exemplo.php", type:"POST", data:new FormData(this), contentType:false, cache:false, processData:false, success: function(resposta){ if(resposta ==…
-
2
votes2
answers4640
viewsQ: LEFT JOIN WITH GROUP BY
I am using PHP and Mysql, I have two tables in the database: POSTAGEM id ---- 1 3 13 CURTIDA id | id_usuario | id_postagem ----------------------------- 1 | 1 | 1 7 | 12 | 1 What I can’t do is this:…
-
2
votes1
answer90
viewsQ: Mask a div with css
On a site that I am developing the top (where the menus are) has a transparent background and is fixed. That is, the site runs behind this top and the top is always fixed. But as it is…
-
1
votes1
answer72
viewsQ: Fixed element having scroll
How to make a div that enters in front of a site (position: Fixed;) have scroll? See an example here: https://jsfiddle.net/caiocafardo/cj5gLt18/5/ Note that when scrolling only the back Ivs that…
cssasked caiocafardo 1,897 -
2
votes4
answers380
viewsQ: column-Count in css by breaking the line at the beginning of the column
I’m using column-Count in CSS to turn a text into 3 columns, so that’s okay. The problem is that I receive text with this Mysql specification: Lorem ipsum dolor sit amet, consectetur adipiscing…
-
1
votes1
answer29
viewsQ: addClass inside this
I have this HTML: <div class="botao"> <div class="seta"></div> </div> In Jquery when you click the button, I add a class to it like this: $(this).addClass('botao_ativo'); How…
jqueryasked caiocafardo 1,897 -
1
votes0
answers27
viewsQ: Install and use a library via NPM
I’m beginning to understand the NPM now, I am very old school and I need to update myself. I installed via NPM Jquery and some library to test (Inputmask). It seems that everything worked out, the…
-
1
votes1
answer58
viewsA: Back button of browser delete a class
I ended up finding a way, if it’s not ideal let me know! I used that function: window.onpopstate = function (event) { if(qualLink == 'perfil'){ // faz algo } } I only feed the variable qualLink…
-
1
votes1
answer58
viewsQ: Back button of browser delete a class
I’m making a website that works on a single page. So when I click on a menu button it scrolls to the area I want with: $('html, body').animate({scrollTop: $('#nomedoid').offset().top},Math.abs(0));…
-
1
votes2
answers81
viewsQ: Identify DIV by complex id
I have several Divs dynamically loaded via PHP like this: <div class="projeto" id="-9-3-21"></div> <div class="projeto" id="-3-1-77"></div> <div class="projeto"…
-
1
votes0
answers237
viewsQ: Allow zooming into mobile phones only in a div
I have an HTML with the meta: <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=yes"/> That is, can not zoom in mobile. But inside this HTML is…
-
1
votes3
answers3450
viewsA: Preloader while the site loads
Well, I ended up using Pace, more details here
-
6
votes3
answers3450
viewsQ: Preloader while the site loads
I’m making a hotsite, it’s one page, and it’s a little heavy, with some pictures. I wanted to do a preloader with %, before loading all the content. With: $(window).on('load', function() {…
-
7
votes5
answers4473
viewsQ: In the ORDER BY of a SELECT change a comma for a period
I have a table in MYSQL (can be seen here http://sqlfiddle.com/#! 9/187ce/1 ), where the price is with commas and not points: 2.00 2,33 11.00 When I’m going to give an order by: ORDER BY preco ASC…
-
1
votes1
answer71
viewsA: Search next date in database
Use greater equal and set a limit to 1, if you have an equal date today, show it, or show the next date. Don’t forget to give an ORDER BY by the date. $data_atual = date('Y-m-d h:i:s');…
-
3
votes1
answer52
viewsQ: select in elements that are not in the array
I have a PHP array with Ids: $idNaoEnvia['1', '3', '6'] And a table called account in MYSQL: ID | NOME 1 | caio 2 | antonio 3 | cleber 4 | marcos 5 | leonardo 6 | andre Wanted using PDO to give a…
-
4
votes0
answers62
viewsQ: How to know the current position of the user in the ranking
I have the table quiz_general and the table account, the table quiz_general that’s how it is: I’m doing a ranking system, it uses several lines to make the sum of points of each user, not just one…
mysqlasked caiocafardo 1,897 -
2
votes0
answers99
viewsQ: Select MYSQL, list row not present in NULL table
I’m making a hotsite with a quiz (questions and answers), with more than 3000 users. The question is in the list of quizzes for each user, I have two tables (simplified to focus on my question):…
-
3
votes1
answer6721
viewsQ: MYSQL calculate the chosen percentage
I’m doing a QUIZ and at a certain point I have to show the percentage of alternatives chosen by users. I have this table: ID RESPOSTA 1 a 2 a 3 b 4 b 5 c 6 a The answer I need from MYSQL would be…
-
1
votes2
answers171
viewsQ: PDO error with variable in LIMIT
In PDO today was the first time I had to put a variable in LIMIT, and I’m getting this error: Fatal error: Uncaught Exception 'Pdoexception' with message 'SQLSTATE[HY093]: Invalid Parameter number:…
-
1
votes1
answer271
viewsQ: Select with MYSQL when it exists in one table and not in the other
I have two tables: QUIZ QUIZ_GERAL I would need to list data from both tables when: The logged in user ID is equal to the IDCONTA field OR When there is a row in the QUIZ table and there is no row…