Posts by Gabriel Heming • 2,479 points
78 posts
-
2
votes2
answers278
viewsA: Assign multiple array to a variable dynamically
Utilize implode to join/concatenate the values of the arrays echo implode(array); See the result: https://3v4l.org/lDbln About the if, if they are comparisons, it is best to deal directly in the…
-
0
votes1
answer1067
viewsA: Consuming Webservice SOAP with PHP - Header problem
Assessing what is described via WSDL and interpreted via Soapui, the code below meets the need: <?php $soapServer = 'https://servicoshm.saude.gov.br/cmd/ContatoAssistencialService/v1r0?wsdl';…
-
6
votes1
answer1019
viewsA: -1 Month does not return to the previous month - PHP
When you use relative formats, you must "relativize" the result. Being today 31/10/2018, using -1 month or last month, the date will be 31/09/2018. When this date is converted to team, or any other…
-
4
votes1
answer156
viewsA: How to add a custom font to TCPDF?
The first note of the documentation link you posted: NOTE: The following information is Valid only fot the old TCPDF library. The new Tc-lib-pdf library uses the new Tc-lib-pdf-font library that is…
-
1
votes1
answer68
viewsA: LDAP authentication, returns true if the password is null
As defined in RFC 4513. 5.1.1. Anonymous Authentication Mechanism of Simple Bind An LDAP client may use the Anonymous Authentication Mechanism of the simple Bind method to explicitly Establish an…
phpanswered Gabriel Heming 2,479 -
1
votes1
answer599
viewsA: Curl failed to send array
According to the manual, the problem occurs because you are sending only one item to the API. The correct thing would be to send a item array, as follows: //demais itens omitidos $data = array(…
-
1
votes1
answer58
viewsA: Improve routes
When creating an ASP.NET Core MVC project, you will default to the following route: app.UseMvc(routes => { routes.MapRoute("default", "{controller=Home}/{action=Index}/{id?}"); }); Basically, she…
-
0
votes3
answers1758
viewsA: Organize array in alphabetical order
There are two issues in its implementation. The first, which is the error you are receiving, is that the variable $campo is not available when the function is executed. The variable must be added to…
-
0
votes1
answer259
viewsA: File submission by CURL php
From the comments in the PHP manual, you can create the function itself curl_file_create: if (!function_exists('curl_file_create')) { function curl_file_create($filename, $mimetype = '', $postname =…
-
1
votes2
answers129
viewsA: Error in viewing multiple Google Maps markers PHP, JS, HTML
You are only printing a marker on the map, so it will only show one. Each marker must be a new object google.maps.Map. Since you are printing via PHP, you can iterate the data via PHP: $latLngList =…
-
4
votes1
answer1184
viewsA: Get Deadline with Postal Web Service
PHP has the native library SoapClient that abstract many aspects of the consumption of a webservice. To connect with WS, it’s simple: $client = new…
-
2
votes3
answers465
viewsA: Join arrays by equal keys, but separating values
You can use the function array_walk to accomplish what you need. The central point, is to reference in callback what is the new array you will create ($newArray) and, as the third parameter of…
phpanswered Gabriel Heming 2,479 -
2
votes1
answer2066
viewsA: Convert latitude and longitude to GMS (Degrees, minutes and seconds)
Your problem is in the code that retrieves the form values. Which is this one: var lat = document.getElementById("latMap").value; var lng = document.getElementById("lngMap").value; When the above…
-
6
votes1
answer603
viewsA: How to upload using PHP image in link BLOB?
The protocol blob or Object-Urls can only be generated by browser and these URL's can only be accessed/managed in the same instance/session of browser, that spawned them. Therefore, it is evident…
-
1
votes2
answers901
viewsA: How to use Multiple select in PHP form to query in MYSQL
The first point is that a select with multiple options, will always send a array. Then, you should treat it as such. However, the name should be treated as an array (name="bairro[]"). <form…
-
1
votes3
answers1083
viewsA: Onclick, With two "Actions" on the same button. PHP
There are N ways to accomplish this functionality. I’ll illustrate using a data-attribute to the HTML element to define/synchronize which action should be executed. As in the example below. function…
-
0
votes1
answer128
viewsA: Problems using Jsbarcode and PHP
Apparently, your problem is a matter of the selector being used incorrectly. You have two ways to solve your problem. The first is to create a unique id for each time you loop:…
-
1
votes1
answer384
viewsA: How to handle reserved character in a . ini file in php?
http://php.net/manual/en/function.parse-ini-file.php#refsect1-Function.parse-ini-file-Notes If a value in the ini file contains any non-alphanumeric characters it needs to be Enclosed in…
-
2
votes1
answer857
viewsA: Run minimized or hidden PHP script by Task Scheduler
As informed on next topic, just use the execution user as SYSTEM or SISTEMA (depending on the operating system language). Another solution, presented in the above linked topic and also by the…
-
1
votes1
answer706
viewsA: Download multiple files
This is not possible, at least not in the "orthodontic" way. The protocol HTTP was developed to send only one file per request. There are two ways (I am in doubt if the second is still possible) to…
phpanswered Gabriel Heming 2,479 -
1
votes1
answer100
viewsA: Add date in days until specific day of the week
Use relative format. First add the days: $date = new \DateTime('+21 days'); This amount you will take from the column of your database. Then change to the day of the week:…
-
0
votes1
answer1837
viewsA: Consume webservice Soap with PHP (xml with attributes)
Although it is a question that has been in the OS for a while, it lacks an answer. Come on. When consuming a Webservice, you should be aware that the parameters defined in the WSDL (both for sending…
-
1
votes2
answers212
viewsA: Search in lambda query with logical operators
This is due to the logic applied in the grouping of conditions. At the moment you add the OR (||), has just returned the result that "marry" one or the other. Translating into the following "story"…
-
0
votes2
answers417
viewsA: what I must do to authenticate the user correctly
Using what PHP provides, you should work with the functions Password Hashing of PHP. password_hash You must create and store the password hash in some repository (database, etc...). To perform the…
-
3
votes1
answer29
viewsA: How to remove class from a dynamically created field?
find works similarly to the jQuery selector. You need to define it as an id, or it will search for tags with that name. I mean, you should start with sharp (#): $('form#hb_form').find('#' +…
-
1
votes1
answer346
viewsA: How do you return all the rows of the SQL query with PHP?
It is important to understand the functioning of each function. The function mysqli_fetch_row, as the manual informs: mysqli_result::fetch_row -- mysqli_fetch_row - Get a result Row as an enumerated…
phpanswered Gabriel Heming 2,479 -
6
votes2
answers786
viewsA: How to catch the last Monday in php
Just use the format date relative: $date = new DateTime("last monday"); That would be the last Monday that passed. Exit: object(DateTime)#1 (3) { ["date"]=> string(26) "2018-05-21…
phpanswered Gabriel Heming 2,479 -
2
votes1
answer443
viewsA: Read contents of a folder and process files asynchronously
Utilize glob. $array = glob('caminho/ate/a/pasta/*.xml'); You can set some folder patterns and use the asterisk to set wildcards, where any character, or amount of them, will be returned. That is,…
phpanswered Gabriel Heming 2,479 -
1
votes1
answer1180
viewsA: Sort Datetime from a Datatable
There are some ways to perform ordering (Sorting) of the kind Date through the Datatables library. By far the easiest is to use what they provide: Datatable: Sorting plug-ins It is advisable to use…
-
3
votes2
answers127
viewsA: Retrieve URI and Fragment Identifier (#)
The reply from @Miguel in the comments is complete enough for the query string (as per the question). About returning the URL without the host (www.site.com), you can only use $_SERVER[REQUEST_URI].…
phpanswered Gabriel Heming 2,479 -
2
votes1
answer187
viewsA: PHP does not give error, but also does not register correctly
Your problem is here: if($stmt2->num_rows <= 0){ while ($stmt2->fetch()){ if($playerID != $playerID_res){ You are validating if there is any player registration (here if($stmt2->num_rows…
-
2
votes2
answers76
viewsA: Failed to display Address class fields when using object creation method expressed in C#
The right thing would be: Endereco end = new Endereco() { logradouro = "Rua teste", numero = "1200" }; Without using the class name before the attribute (as you were doing). However, there is a…
-
1
votes1
answer56
viewsA: Update record in table using Selected in MYSQL
When you are query the user data you are not returning the ID fields: "SELECT idVeiculo, placa, prefixo, b.tipoveiculo, c.nomesetor FROM ..." Add the fields a.idTipo and a.idSetor Enable error…
-
0
votes1
answer414
viewsA: How to change the class of the div according to Ajax’s response?
Retrieve the element via ID and add the new class: jQuery('#errolog').addClass('nova-class'); Since you can have more than one class in HTML elements, adding a new class will not remove the old one.…
-
1
votes3
answers299
viewsA: Search filtering error (PHP)
Mysqli library does not have the function mysqli_result. In fact, she’s a class which is returned by the method mysqli_query or by the method mysqli_stmt::get_result (when using a Prepared…
phpanswered Gabriel Heming 2,479 -
3
votes1
answer1038
viewsA: XML printing Object(Simplexmlelement)#1 (0) { }
TL ; DR var_dump not necessarily will display all of us to SimpleXMLElement; If there is no error, it means the parse occurred and the object SimpleXMLElement was created; Can use XPath to fetch a…
-
0
votes1
answer54
viewsA: How to remove an "item" from the last record?
Invert the order and add a logic to delete from the first record that will be easier: $first = true; while($row = mysql_fetch_assoc($userdata)) { if (!$first) { echo '<div…
-
0
votes1
answer80
viewsA: I need to separate strings to import to mysql
You are using the function explode and trying to separate the string by comma, however, the CSV is using semicolon (;) as a separator. Another detail, you can use the function fgetcsv. Just set the…
-
1
votes2
answers521
viewsA: Reset html x reset javascript efficiency
The basic difference, which has already been told by @Evandro Mendes, is that one is native and another is personalized. That is, via Javascript you can handle the form the way you want. On the…
-
3
votes2
answers337
viewsA: How does the destructor ("__destruct" method) work in PHP?
In PHP, there is no Garbage Collector, but destructor methods I think you’re wrong. PHP: Garbage Collection Where and when to use destructor method? The concept of destruct equals the language C++:…
-
1
votes1
answer160
viewsA: Can’t I return all the input data with PDO?
The inputs of the type checkbox, radio and select has the default value set differently from inputs of the kind text. To checkbox and radio works the same way. You must add the attribute checked.…
-
2
votes1
answer620
viewsA: Generate report in the background in php
There are some ways to accomplish what you need, one of them very simple and the other would need interaction with the shell. AJAX The first and simplest of all, Request the script via AJAX. Being…
-
6
votes1
answer5136
viewsA: "New" autoload from PHP 7
I would like to understand the "new" autoload of PHP[...] New in parts. Autoload through function spl_register_autoload is available since version 5.1.2 of PHP (January 12, 2006). And, even so,…
-
2
votes4
answers155
viewsA: How to create function with SINGLE BUTTON to open multiple class together?
You could make a single button that controls the open/close state, but in my humble opinion, the state control for a button that opens and closes time all elements is somewhat confusing, whether for…
-
17
votes2
answers12279
viewsA: Complete number with zeros on the left with PHP
Use the function str_pad together with the flag STR_PAD_LEFT. echo str_pad('5' , 4 , '0' , STR_PAD_LEFT); Exit: 0005 Or with 100: echo str_pad('100' , 4 , '0' , STR_PAD_LEFT); Exit: 0100…
-
2
votes1
answer89
viewsA: Do While is not working properly
When comparing strings, use the method equals(). Yeah, the comparators == will compare to object references (if they are the same object). The method equals() will compare whether the value of an…
-
0
votes1
answer63
viewsA: Why Debugger jumps line with header, not going to the link?
The Debugger enters if and arrives at header('Location:login.php'); but it does not go to the login.php page. To understand the actual functioning, it is necessary to understand how the header…
-
1
votes1
answer153
viewsA: Show all database files on a php page?
Your error is occurring because of a "typo". See, to open the query, is using: if ($resultado = mysqli_fetch_array($consulta)) { Meanwhile, in the do/while, is using while ($resultado =…
-
4
votes4
answers882
viewsA: Update the data in the database without changing the others that already exist - PDO
You have two problems with your code, the first is that with each new field, you are replacing the previous one (as reported by @rray). You should use as an array: if(!empty($nome)) $campos[] =…
-
4
votes1
answer247
viewsA: Javascript function to add days, is adding up a month ahead
Javascript Date object month has the period between 0 (January) and 11 (December) and not between 1 and 12. So, in your calculation, you can subtract the month from the user input in -1. return new…
javascriptanswered Gabriel Heming 2,479