Posts by Jefferson Silva • 1,211 points
31 posts
-
-1
votes1
answer39
viewsA: What javascript:nameFunction(); does?
You probably saw the use of javascript: within a link. It is a widely used practice to invoke a javascript in the link click: <a href="javascript:alert('HELLO');"> H E L L O</a>…
javascriptanswered Jefferson Silva 1,211 -
2
votes2
answers536
viewsA: Laravel validation if there is a child record
You can do this by creating a custom validation rule: https://laravel.com/docs/5.8/validation#custom-validation-Rules <?php namespace App\Rules; use Illuminate\Contracts\Validation\Rule; use…
-
1
votes1
answer41
viewsA: Ajax with PHP is not recognizing POST method index field
$('#ncomanda['+i+']').val(); $('#scomanda['+i+']').val(); The above codes are returning "Undefined", which causes the variables not to be sent to PHP. Check the selectors ;)…
-
1
votes2
answers49
viewsA: SQL Latest Record FROM segnda table by Id
Hello @Denis, I know it’s been a long time since the question, but I think it’s valid to leave it quoted here: This approach of doing a new query with each loop usually brings problems when we are…
sqlanswered Jefferson Silva 1,211 -
1
votes4
answers196
viewsA: Get the id of where max(value) was found
SELECT id,data,valor FROM teste WHERE data BETWEEN '2017-03-01 00:00:00' AND '2017-04-01 00:00:00' ORDER BY valor DESC LIMIT 1;
mysqlanswered Jefferson Silva 1,211 -
0
votes2
answers74
viewsA: Problems with the user profile
Change this excerpt: $login = $_SESSION['login_usuario']; $login = $_SESSION['login_usuario']=$login; For this: if( !isset($_SESSION['login_usuario'])) die('Usuario nao logado'); $login =…
phpanswered Jefferson Silva 1,211 -
1
votes2
answers304
viewsA: Php preg_replace replace src image
You don’t even need preg_replace. $html = '<img src="images/teste.jpg" border="0" width="486" height="370" style="margin: 5px; float: left;" /><img src="images/teste2.jpg">'; echo…
-
1
votes4
answers15429
viewsA: addClass and removeClass with Jquery
$(function() { $('.bolinha-dentro').click(function(){ $('.bolinha-dentro').removeClass('ativo'); $(this).addClass('ativo');…
-
1
votes3
answers366
viewsA: Get URL paths
Another way to get the id is by using split. In a very simple way, using angular: //http://localhost:8181/api/collections/{id} angular.module("APP",[],function($locationProvider){…
-
3
votes3
answers933
viewsA: How to remove the last character, store the result in a variable and use the variable outside of foreach?
I usually use a simpler approach when I want to turn an array or object into a comma-separated string. <?php $rows = array("125", "148", "157", "169", "185"); echo implode(',',$rows);…
-
0
votes1
answer45
viewsA: List database file and put a new row after a certain number
$count = 1; while( $row = mysql_fetch_array(mysql_query("SELECT * FROM playlists where codigo = '".$_POST["playlists"]."'")) ) { if( $count == $escolha_usuario1 ) { echo…
-
13
votes2
answers16374
viewsA: What is the difference between Ajax dataTypes in jQuery?
Source: http://api.jquery.com/jquery.ajax/ XML: Returns an xml document that can be processed via Jquery. the return must be treated as XML nodes $.ajax({ url : "xml.xml", dataType : "xml", success…
-
0
votes1
answer1084
viewsA: Consume a Rest API and Persist the Data in a Local Database - Titanium
Here is an example of how to make the requisitions, which was taken from: http://developer.appcelerator.com/question/145460/retrieve-json-from-server-and-commonjs-module function stringify(obj) {…
-
2
votes2
answers1891
viewsA: json search with ajax in specific field
Only if left to check if what the person typed matches any tag just add this code into the loop: $.each(data, function(i, item) { aux = item.Tag.trim().toLowerCase().split(",") if(…
-
4
votes3
answers2111
viewsA: Convert date format DD/MM/YYYY to YYYY-MM-DD stored in a scan
Based on the fact that you want to update the database directly, follow an update where using the mysql SUBSTR function on all records that do not contain "/". UPDATE tabela SET campo_data =…
mysqlanswered Jefferson Silva 1,211 -
3
votes1
answer102
viewsA: Count back
$(function(){ $('#add').click(function(){ var count = $("ul").children().length; $('ul').append('<li><i class="indice"…
-
1
votes1
answer41
viewsA: Switching Web Pages Every So Long
In panel 1 Voce adds this to the header: <meta http-equiv="refresh"content="180; url=http://ENDERECODOPAINEL2.COM"> In Panel 2 Voce adds this to the header: <meta…
-
2
votes1
answer42
viewsA: Help with object array
From what I understand, you should check if an Dice exists before comparing it. Avoiding error: for($i = 0; $i<sizeof($arrayBDs);$i++){ var_dump($arrayBDs[$i]['nome_tabela']);…
phpanswered Jefferson Silva 1,211 -
1
votes1
answer76
viewsA: Finish youtube video soaked in as3
If what you want is not to display the related videos at the end of the video, just add the parameter rel=0 at the end of the url. For example: <iframe width="560" height="315"…
-
0
votes4
answers706
viewsA: Place a url in the text field and show it in a DIV next door
Hello, In a very simple way, and without validations would be more or less like this: $(function(){ $('#btn_carrega_imagem').click(function(){ $('#container_img').html('<img…
-
1
votes3
answers1746
viewsA: How to list a json object to generate a txt file and download that file via ajax request?
Simplifying the answer to your questions: 1 - How to read the object passed by ajax in PHP. $_POST[????] <?php $data = $_POST['data']; $paging = $_POST['paging']; ?> You can also use one to…
-
2
votes2
answers364
viewsA: slideToggle hides multiple Ivs when it should hide/display only one at a time
Assuming your code is already ok, and that you use jquery, I will add a unique identifier for each record and by js calling only this unique identifier Editing to insert a fiddle... $(function(){…
-
1
votes1
answer378
viewsA: Return Ajax value in input
Substitute: result.innerHTML = xmlreq.responseText; For: document.getElementById("iddomeucampo").value = xmlreq.responseText; getting: function getDados() { // Declaração de Variáveis var nome =…
-
4
votes2
answers532
viewsA: Advanced image optimization and compression on web servers without using external services
beauty? If what you need is to compress images for optimal use on the web, I recommend reading this article which i had satisfactory results.…
-
0
votes2
answers68
viewsA: PHP Query Error
Hello, probably your query is not bringing results <?php include ("sistema/validar_session.php"); include("config.php"); $login = "Goncalo"; $select = mysql_query("SELECT * FROM dados_usuarios…
phpanswered Jefferson Silva 1,211 -
5
votes2
answers466
viewsA: Find out which table the data is from, in a Union
You can add an identifier in select and then make an if in your code $data['dados_tabelas'] = Tabela1::find_by_sql("SELECT 'tbl1' as identificador,* FROM tabela1) UNION (Select 'tbl2' as…
sqlanswered Jefferson Silva 1,211 -
4
votes1
answer805
viewsA: PHP - Concurrent user control?
Without a database I would do so: <?php $tempoHoras = 6; ini_set('session.gc_maxlifetime', $tempoHoras * 3600); # Tempo em segundos ini_set('session.save_path', '/caminho/para/suas/sessoes'); #…
phpanswered Jefferson Silva 1,211 -
1
votes3
answers6202
viewsA: Pass View Variable to Controller
Opa, I don’t know if you’ve solved it yet, but building a menu with category/subcategory is standard in any language using recursive function I’m a little out of time to explain in detail, but given…
-
0
votes2
answers278
viewsA: How to modify the input file path?
if you are interested in working on something ready, take a look: http://elfinder.org/ Plus, and what @Pedrohenrique replied. Abs…
-
1
votes3
answers318
viewsA: Converting a datetime to text does not show the result
I do so: <?php echo date('d-m-Y H:i:s', strtotime($datadobanco) ); ?> In the first parameter you should use the format according to this reference:…
-
30
votes5
answers52381
viewsA: Regular expression to detect credit card flag
For those interested, follow a list of Bins: | Bandeira | Comeca com | Máximo de número | Máximo de número cvc | | ---------- | ------------------------------------------- | ---------------- |…
regexanswered Jefferson Silva 1,211