Posts by Jader A. Wagner • 4,921 points
176 posts
-
2
votes1
answer443
viewsA: Div dinamica + php
Yes it is possible to do with jquery and javascript, as in the example below: jquery: var req = 0; $(document).ready(function () { update(); }); function update() { req++; $.ajax({ type: "POST",…
-
1
votes3
answers275
viewsA: How to make a php script inserted into a page through a "require" run from time to time?
Assuming your code is already working correctly, you can include this query at the beginning of the website homepage, for example: index php. <?php require 'config.php'; require 'connection.php';…
-
2
votes5
answers7129
viewsA: Number of weeks in a month
The function below finds the number of weeks in a given month, assuming Monday as the first day of the week. function weeks_in_month($month, $year) { // Start of month $start = mktime(0, 0, 0,…
-
5
votes2
answers1263
viewsA: Convert a string url to hyperlink
The problem is that when you find the first occurrence, you’re replacing them all, then you get the second repeated occurrence and you have them replaced again, and you go into a chain reaction,…
-
0
votes4
answers95
viewsA: Add a "pass" limit to a Carousel slider
Full update: Just control the current slide, and do not allow to go before 1 or after the number of slides: var sliderWidth = 300; var slide = 1; var slider = $('#slider'); var sliderCount =…
-
3
votes3
answers13183
viewsA: HOVER effect on a <li> and the components within it
Place the image directly in li, it is much easier: HTML: <ul> <li id="sair">Sair</li> </ul> CSS: #sair { display:inline-block; width: 50px; padding: 2px; background:…
-
3
votes1
answer855
viewsA: How to achieve a slideToggle effect with jQuery?
Start with something like this: jquery: $('.disparador').click(function () { $(this).animate({ width: ($(this).width() == 200 ? 100 : 200) }); $(this).siblings('.painel').animate({ width: 'toggle'…
-
1
votes2
answers440
viewsA: Select only 1 record with the same category and Hidden in the other
The behavior of GROUP BY That’s right, join the same records and show only 1. You must use the ORDER BY to join the equals and show one after the other, at the end of while memorize the category to…
-
3
votes1
answer145
viewsA: Problems with slideDown in jQuery
The new element should come hidden so the slideDown can show it, add display:none online or in the class of the new element: $(document).ready(function(){ //when the Add Filed button is clicked…
-
1
votes1
answer540
viewsA: Compare top distances of an element with the following next()
As answered in the commentary, the problem was when it reached the last element and there was no next .next() causing the error. Please edit this answer and include the corrected code here, for the…
-
4
votes2
answers103
viewsA: Why @ disappears by clicking on the link
Another alternative is to use the function http_build_query as in ex. below: $mail_message .= '<a href="' . $url_sender . '/redefinir-senha?' . http_build_query(array( 'email' =>…
-
2
votes1
answer79
viewsA: Change Element mouseover/mouseleave
You must do something like this: var bannerDefault; // declara a variável no escopo global $('.quartaImagem').hover(function (e) { bannerDefault = $(".banner").attr("src"); // memoriza o src atual…
-
5
votes3
answers14892
viewsA: function $.Ajax() return value?
You are returning the date inside the function, but do not return anything outside it, try it like this: var res = VerFileRepetidoBancoAjax( "teste" ); console.log("res="+res); function…
-
2
votes1
answer93
viewsA: Incompatibility of Javascript Code
There is a small bug with IE and Firefox, and to get the border color you should ask for border-top-color, as in ex. below: jquery: $('#myTab a').click(function (e) { e.preventDefault();…
-
2
votes2
answers89
viewsA: PHP settings required for local server
Try to equalize the version and active modules, few things in php.ini will generate code incompatibilities. Use the function phpinfo(); it returns all settings and enabled modules, just run on both,…
-
4
votes3
answers7802
viewsA: Why did replacing all my "mysql" with "mysqli" stop my project?
You probably use native functions throughout the code: mysql_query, mysql_fetch_array, mysql_num_rows and etc... So to change, for example, from: mysql_query for mysqli_query, you also need to…
-
1
votes2
answers544
viewsA: Rank database [#1 of 10]
Based on your example, simply modify the subselect fields to fit your criteria: (get the rank ordered by the name of Aaz) SELECT *, FIND_IN_SET( id, ( SELECT GROUP_CONCAT( id ORDER BY nome ASC )…
-
5
votes1
answer9311
viewsA: How to change the color of a link when passing the mouse (mouse)?
This is very basic, I suggest you study a little more about classes, and their properties, a good place to learn a lot is on the site W3schools. Anyway, follow a small example: CSS: ul {…
-
0
votes5
answers1501
viewsA: How to take the name of the variable used in the function argument?
I think it is not possible, the only alternative that occurs to me, would be to pass the variable name as string in the parameter: $variavel = 'Olá mundo!'; sendData('variavel'); function…
phpanswered Jader A. Wagner 4,921 -
6
votes2
answers14096
viewsA: How to display echo quotes in PHP?
When you want to show the same type of quotes you are using to enclose the string, you need to escape it using a slider \ $string = 'aspas simples: \' e aspas dupla: " '; $string = "aspas simples: '…
-
3
votes1
answer1330
viewsA: mysql error when importing tables
There is already a record with primary key 1, you are trying to reinsert data that already exist...
mysqlanswered Jader A. Wagner 4,921 -
2
votes2
answers3680
viewsA: How to do the . jQuery load only the content inside the <main>?
Just place the element you want to load after the separate URL with a space, as in e.g. below: $(".ajax").on("click", function(e){ e.preventDefault(); //eliminamos o evento var path =…
-
8
votes3
answers329
viewsA: How to pass Id next to pagination ex: index? pag=pagina&ID?
All variables passed in the URL after the ? (separated by &) can be obtained in PHP using the array superglobal $_GET as in the diagram below: $_GET['pag'] == 'estudos' $_GET['pagina'] == 1…
-
1
votes4
answers853
viewsA: Click event only works the first time
I got it working on the fiddle: http://jsfiddle.net/jaderw/1f4efku7/ jquery: (I marked below what was modified) $('.featured .client').on("click", function (e) { e.preventDefault();…
-
6
votes3
answers4061
viewsA: Insert an empty row <tr> at each size range of an html table (With Javascript)
You can do with jquery, as in the example below: jsfiddle: http://jsfiddle.net/jaderw/tfmpouse/ var altura = 0; $('#tabela tr').each(function(index, element){ altura += $(this).height(); if (altura…
-
1
votes6
answers261
viewsA: Parser Bbcode ignore what is inside [code]
I think that’s about it, just modify the function within the preg_replace_callback for what you need: $text = "Teste de string com code: [code]<p>teste</p>[/code] e continuação de teste…
-
1
votes3
answers1380
viewsA: Switch page time transition
I found the effect very interesting and I decided to try to do, until it became similar: jsfiddle: http://jsfiddle.net/jaderw/dwLc7e8c/ jquery: $('.menu a').click(function(event) {…
-
5
votes2
answers3503
viewsA: Select to subtract current value from previous and return column with result
It is possible to do with a variable: select *, ( v.valor - @lastValue ) as amplitude, @lastValue := v.valor from valores v, ( select @lastValue := 0 ) SQLVars order by v.amostra_id sqlfiddle:…
-
1
votes1
answer436
viewsA: Carousel or Cycle displaying 6 elements in grid format
You are trying to limit the width of the parent container and make the content break inside it automatically, and so it will not work with the slider. You should split the content and have the…
-
2
votes2
answers1694
viewsA: Check fields when giving Ubmit and if error return to field
Below is a small example: jsfiddle jquery: $("form").submit(function (event) { event.preventDefault(); var erro = false; var elemento; // limpar marcação de erro da tentativa anterior: $('form…
-
2
votes3
answers800
viewsA: List every month in an intevalo, or in the query or in the programming?
It wasn’t the most beautiful thing in the world, but it worked: $rows = array(); $query = "SELECT DATE_FORMAT(dt_validade, '%m-%y') as anoMes, count(*) as qtde FROM tabela WHERE dt_validade >…
-
2
votes4
answers3838
viewsA: How to run a PHP function in the background?
I think it is possible to do the background execution using Curl as in the example below: background-script.php if ($_GET['iniciarbackground'] == 'true') { // chamada iniciada pelo ajax $ch =…
-
0
votes2
answers198
viewsA: PHP: If Result with Function
Your function is not validating the input date, I added the check to return false if the date is invalid or null and added the default value of days: function estaParaExpirar($data, $dias=10) { if…
-
3
votes2
answers1373
viewsA: How to make a select with dynamic columns for each like?
Use sum(), for example: SELECT date( calldate ) AS 'Data', sum( dstchannel LIKE '%claro%' ) claro, sum( dstchannel LIKE '%oi%' ) oi FROM cdr where (dstchannel regexp 'claro|Tim|vivo|oi|nextel') and…
mysqlanswered Jader A. Wagner 4,921 -
4
votes1
answer3266
viewsA: Call javascript function
You can use CSS to delete columns just in print: CSS: .no-print { opacity:.5; } @media print { .no-print { display:none; } } HTML: <table> <tr> <td>Coluna 1</td>…
-
3
votes2
answers15380
viewsA: open new php window
Another alternative would be to do click by ajax accounting: HTML: <a href="<?php echo $go_to_url; ?>" class="anuncio" target="_blank">Anúncio</a> jquery:…
-
1
votes1
answer148
viewsA: "Quadrant", analyze area around the square
If you already know the position of the row and column, it is basic to think that: (row - 1) is in the top row and (column + 1) is in the back column, and so on...…
-
2
votes3
answers502
viewsA: INSERT query does not work inside a loop
I think you have to trigger the bind off the foreach, try it like this: $cadastraresposta=$pdo->prepare("INSERT INTO…
-
1
votes2
answers143
viewsA: JQuery problem of a MENU with two <ul> ’s
According to the template you passed me by chat, your second UL is A’s child, so jquery had to be adapted: HTML: <ul id="menu"> <li> <a href="blog.html">Atendimento</a>…
-
2
votes2
answers2234
viewsA: Check variables in jQuery?
You could do something like this: $("#oformulario").submit(function(){ var erro = false; $(this).find('input:not(.campo-nao-obrigatorio)').each(function() { if ($(this).val() == '') erro = true; });…
-
6
votes3
answers367
viewsA: jQuery - Typical duplicate use situation of the same code. How to proceed?
Separate selectors with comma: jQuery(function(){ jQuery("#botaodeacao, #botaodeacao2").click(function(e) { jQuery("#oformulario").slideToggle(1500); }); }); In fact the jquery selector works…
-
1
votes4
answers186
viewsA: Dropdown menu opens partially
I don’t know anything about bootstrap, but I’m very interested... The path seems to be this way: CSS: .dropdown-menu{ position:fixed; } jquery: $('.dropdown-toggle').click(function (){…
-
3
votes1
answer3714
viewsA: Mysql - Count different values from the same field
You can do with the SUM(): SELECT name, sum(win='Y') AS vitorias, sum(win='N') AS derrotas FROM partidas GROUP BY name; Ex:…
-
2
votes1
answer807
viewsA: Applying recursion in a batch script
According to a test I performed here, your bat already works recursively: test bat. @echo off set filesCount=0 echo Performing OCR over files echo. for /r %%i in (*.mdi) do ( set /a filesCount+=1…
-
2
votes1
answer345
viewsA: What measures can we take to protect the issuance of malware slips that alter the digitable line?
You could mount the digitable line with images of the numbers, or generate "on the fly" an image with the whole number, but this would make the client have to type it manually, without being able to…
-
0
votes2
answers347
viewsA: change function the loading of jquery pages for onclick
Have a way of doing without having to modify the links on the pages: jquery: function jaw_href(href, parametros) { return encodeURI(href.replace(/#*/g,'') + (href.indexOf('?') != -1 ? "&" : "?")…
jqueryanswered Jader A. Wagner 4,921 -
1
votes1
answer111
viewsA: Check page and assign DIV
It would really be better to use a template file loading the content through parameters in the URL, but if you are used to this structure, and/or prefer the URL to stick to the file names simply,…
-
2
votes2
answers364
viewsA: move text to a box
Here is a brief example in jquery: (just include the necessary conditions and checks) jquery: $('.botao_add').click(function(){ $(this).parent().children('select').append($('<option>', {…
-
3
votes2
answers11265
viewsA: How to edit the CSS of an iframe?
I was able to do only with jquery using a proxy, now just work with css and script to work tabs, but this I leave with you: jquery: $('#divframe').load( 'http://www.corsproxy.com/' +…
cssanswered Jader A. Wagner 4,921 -
3
votes3
answers3924
viewsA: Insert external video or HTML or JS into a div
For all videos on the page to work correctly, it should be like this: jquery: $('[data-id]').each(function(){ $(this).html( '<iframe width="560" height="315" src="http://www.youtube.com/embed/' +…