Posts by DNick • 2,862 points
107 posts
-
0
votes2
answers310
viewsA: trigger Function after form validation
There is a javascript plugin called jQuery Form. I recently posted a example how to use it. It has the parameter beforeSubmit that you can call a Function and apply $("#form3").validate() and…
-
2
votes2
answers99
viewsA: Group by mysql adding null values
If "But when values have no results they are not in select" are values NULL. Mysql contains a function called COALESCE. It returns the first value not null of the query. If there is none you can…
-
1
votes2
answers251
viewsA: Upload multiple images by saving only one file
When multiple files are attached in one <input type="file">, the $_FILES will come in this format: /* array(1) { ["file"]=> array(5) { ["name"]=> array(2) { [0]=> string(13)…
-
1
votes4
answers1418
viewsA: How to format result with comma and dot?
There is a method called toLocaleString(). This method returns a string with a language-sensitive representation of that number. According to the exit documentation default of the method is American…
javascriptanswered DNick 2,862 -
3
votes2
answers70
viewsA: Verficar buttton radio
To capture the radio "checked": $(document).on('click','#teste',function(){ checkRadio(); }); function checkRadio() { var isChecked = $("input[name=area]:checked").val(); if (!isChecked) {…
-
3
votes3
answers881
viewsA: How to redeem all data of the current month grouped by date?
Anderson’s answer is correct, but one caveat to make is the processing of the data. In a table with many records the query will be slower due to comparison WHERE MONTH(`datetime_start`) =…
-
0
votes2
answers676
viewsA: Seeder Laravel with 2 relationships
To illustrate how to work with seeders we have the relationship between the tables company and bank 1-N: Models //Company Model public Function bank() { Return $this->hasMany(Bank::class); }…
-
0
votes2
answers642
viewsA: I removed branchs (Git), but they "continue" there, how to remove it for good?
To delete a branch remote git push orgin :nome_da_branch To remove the reference from branch of the other developers each will have to enter the command: git fetch -pt The option -pt of command…
-
0
votes1
answer326
viewsA: PHP error when displaying search result with select
Regarding your question about mysql and mysqli. First it is important to know which shape mysql works in procedural and mysqli of the object-oriented form. Here you find how to work both ways. The…
-
1
votes2
answers2042
viewsA: Problems passing instantiated object by function parameter with php
The problem you’re having is Dependency injection . The dependency of one class occurs when "injected", passes one class to be worked within the other. This means that in order to have an injection…
-
1
votes1
answer217
views -
0
votes3
answers268
viewsA: PHP How do I make an image to be the default icon if I don’t have an image selected?
You can do as follows. Let’s use as example user registration. With each new user created, you can associate an image default.jpg already located in your project. To manage you create a database…
-
16
votes3
answers3678
viewsA: Can I upload folders along with the code on Github?
Git does not allow empty directories. But when I need to upload a folder I create a hidden file inside the directory to upload that directory. For example: touch pasta/.teste Apply the git add…
-
6
votes2
answers197
viewsA: Check if it is the class
With pure javascript you can do so: <div id="teste" class="teste2"> Teste </div> <script> var div = document.getElementById('teste'); console.log(div.classList.contains('teste2'));…
-
1
votes2
answers895
viewsA: How to display in the browser and in a friendly way information from a JSON file?
install via commiserate the package var-Dumper. add the line: dd(json_decode($seu_json)); If the data comes in array just pass the parameter inside the dd(): dd($seu_array); outworking: This way you…
-
2
votes1
answer320
viewsA: Render a part of a PDF document to an image file
To solve your problem I used the package SPATIE available on github. Only perform package installation via commiserate as per package documentation. Follows code: <?php use Spatie\PdfToImage\Pdf…
-
0
votes1
answer233
views -
0
votes2
answers408
viewsA: multi upload php
On his last question had forgotten to put the html for example <form action="upload.php" method="post" enctype="multipart/form-data"> <label>Add New Album</label> <input…
-
1
votes1
answer1009
viewsA: How to submit a form and after the submission load a div with ajax
To capture the data, validate and return a reply without refreshing the page, only making an asynchronous request. There is a javascript plugin called jQuery Form. It has two methods called:…
-
1
votes1
answer2299
viewsA: Storage capacity Mysql
According to the Mysql documentation 5.7 about the limit in table size, says: C.10.3 Table size limits The maximum effective table size for Mysql databases is usually determined by operating system…
-
1
votes1
answer64
views -
2
votes3
answers270
viewsA: Searching data in database
For your code to work we will make some changes. But first let’s theory. You are using the procedural form of mysql_query and is skipping a few steps. If you want to know more, there is the…
-
6
votes1
answer11657
viewsA: Duplicate database record with new id
You can make a INSERT SELECT at the same time, like this: INSERT INTO tabela (campo1, caompo2, ...) SELECT campo1, caompo2, ... FROM tabela WHERE primary_key = 3; Obs.: You must pass the same amount…
-
10
votes2
answers3018
viewsA: Is it really necessary to create an auxiliary 3rd table in N-N relationships?
First I will quote, based on books, concepts about cardinalities N x N and then answer your questions: According to the authors, when relations between two tables are N x N: Leite, Mario (2008): In…
-
3
votes1
answer378
viewsA: Database does not work
To connect the bank using mysqli_query, according to the documentation of PHP, there are two ways: Procedural: mysql_query Object-Oriented: mysqli_query Note: Only in procedural style uses the…
-
0
votes1
answer230
viewsA: Retrieve remaining data via array ID
According to the Manual of PDO there is a feature called lastInsertId which aims to access the id of the last line or sequence value inserted. You can do it like this: $stmt =…
-
0
votes2
answers395
views -
0
votes1
answer208
viewsA: Insertion in Mysql via PHP foreign key
Just one note. To make sure you handle connection errors, add the line $conn->setAttribute(), as follows. The default PDO error is PDO::ERRMODE_SILENT. Switch to PDO::ERRMODE_EXCEPTION to enable…
-
1
votes2
answers257
viewsA: How to filter Json data with jQuery?
The Jquery contains a method for handling JSON called: JQuery.parseJSON (). To use it is very simple: var pessoas = jQuery.parseJSON( '{ "name": "John" }' ); Follows documentation: Jquery.parseJSON…
-
8
votes1
answer231
viewsQ: How to use the 9th rule of Object Calisthenics in PHP?
Object Calisthenics making a translation into Portuguese means "programming exercises", and consists of 9 rules created by Jeff Bay in his book The Thoughtworks Anthology. The Object Calisthenics is…
-
1
votes1
answer276
viewsA: Problems with insert INSERT mysql
You have not commented on the made configuration to work with PDO. Because first of all, it is necessary to enable the PDO driver and the driver for the database that will be used. In this link…
-
1
votes1
answer166
viewsA: map jquery keyboard events - Accessibility
The best way for you to do this is to map the keys you will use, because each key has its numbering. In your case capture the pressed key, set which DOM element you want to work, ie you will receive…
-
2
votes1
answer276
viewsA: Multi upload with various php and mysql formats
In one of my projects I had to carry out a treatment sementant to the proposed in the question. I’ve made a few adjustments to suit your scenario. $files = $_FILES; $config = [ 'type_file_allowed'…
-
1
votes2
answers496
viewsA: Business rules should be in the Entity in the DDD enclosure
Not, As Entity are object classes and need to have an identity, that is, something that identifies that entity is unique. As for example the id or uuid. In entities will only access attributes and…
-
1
votes1
answer204
viewsA: After php query open result on a new page
As commented by Anderson Carlos Woss. The correct thing to do is an asynchronous request. But anyway, you can do it using the LocalStorage: success: function (response) {…
-
5
votes2
answers7180
viewsA: Get the value of radio input with javascript
To capture the input's of form using only javascript: <form id="form"> <h3>1. Which tag should used to represent the "header" of a document?</h3> <ul> <li><input…
javascriptanswered DNick 2,862 -
2
votes5
answers3695
viewsA: Regular expression to find bar
To complement the above answers, to use the regular expression explained above you can do as follows: PHP $codigo = 'RN/1234567'; $regex = '~[A-Z]{2}\/[1-9]{1,}~'; if (preg_match($regex, $codigo)) {…
-
0
votes1
answer244
viewsA: jquery datatable display details
Comment on everything inside: $('#example tbody').on( 'click', 'tr td.details-control', function () { //comentar }); And add the code: var trs = $('#example tbody tr'); for(var i = 0, len =…
-
0
votes5
answers1163
viewsA: PHP only connects to Mysql?
When we talk about database extensions PHP, according to the documentation, there are two distinct groups: The layers of abstractions, and; Vendor-specific database extensions. Referring to the…
-
1
votes2
answers222
viewsA: PDO and mysqli are the only options to work with PHP database?
When we talk about data bandwidth extensions PHP, according to the documentation, there are two distinct groups: The layers of abstractions, and; Vendor-specific database extensions. Referring to…
-
1
votes2
answers252
viewsA: Apply immutability effect to objects in a Javascript class ECMA6
I was reading about defensive programming and I believe I’ve found an alternative to the problem of date be mutable. To prevent object type values in an object frozen by freeze() be amended, such as…
-
1
votes1
answer170
viewsA: Do I need to create columns in phpmyadmin for every checkbox I created?
What will decide how the data will be saved in the database will be the Entity and Relationship Model (MER) prepared. As mentioned in the question, you have created a website aimed at the…
-
7
votes2
answers252
viewsQ: Apply immutability effect to objects in a Javascript class ECMA6
To illustrate, I have the following class: class LavarCarro { constructor(cor, placa, data_entrada) { this._cor = cor; this._placa = placa; this._data_entrada = data_entrada; Object.freeze(this); //…
-
1
votes1
answer94
viewsA: IP validation without updating the page
For your logic to work, I had to make some changes. I had many mistakes that make the reason for the problem a mystery. But finally make the following changes: Filing cabinet index.html <html>…
-
1
votes2
answers940
viewsA: Laravel eloquent returning array of array
William, I know your question was specific about the eloquent. But without the bank structure it is difficult to help you. A palliative solution would be to use array_map in the result to format the…
-
0
votes1
answer73
viewsA: each of jquery does not find "TR" dynamically added to table
I think I understand what you need to do. The idea is to search for columns in the table. If I’m wrong correct me. To make this feature, the fields <input/> evening at the <thead>, not…
-
1
votes1
answer163
viewsQ: What is the MERGE_MSG.swp file?
When executing the command of merge of my branch in another. The following warning has occurred: As per the image description itself. The alert is displayed because the file .MERGE_MSG.swp is also…
-
2
votes4
answers17336
viewsA: How do I copy commits from one branch to another?
I know the question is already solved, but to increase the knowledge line of the contents already posted. In this link there is a mini tutorial on how to apply the command Cherry-pick where the…
-
10
votes1
answer527
viewsQ: Are all HTTP methods/verbs accepted by APACHE and NGINX?
In a talk I had recently, one of the speakers commented that the only methods that, in fact, the APACHE and the NGINX accept/support are methods/verbs GET and POST. The speaker further clarifies…
-
1
votes3
answers1169
viewsA: How to store the data in a variable and then use a query?
Make the following changes to your code: To get the doctor $query = "SELECT id, nome FROM Medicos"; In the display of the data in the doctor in the combobox <?php while($prod =…