Posts by Gabriel Heming • 2,479 points
78 posts
-
2
votes1
answer58
viewsA: Error in MYSQL PHP JOIN function
Although you use a nickname (alias) for the table (in query), this is only recognized by the database. You need to add an alias to the column as well, because the fetch that the driver does…
-
2
votes2
answers171
viewsA: Sorted list PHP+AJAX
Whereas your query returns results, in principle your problem is that the return of AJAX interpreted by Javascript is a string and you’re treating as JSON. To resolve this, add the property…
-
3
votes2
answers113
viewsA: Complete next field without user having to give TAB
You are using the function through the Event Handler onblur (or just Blur jquery). That is, it will be executed whenever the field loses its focus state (onfocus). In this case, change your…
-
0
votes1
answer213
viewsA: How to make a call about an API response
The Open Weather Map API supports multilingualism, which in this case would be for Portuguese. Since the Portuguese offered is not specific to Brazil (probably that of Portugal), you would have to…
-
0
votes3
answers1209
viewsA: Sum hours of an array
Your problem lies precisely in the function gmdate, as it will format a date from a timestamp (Unix Epoch). As in the example below: gmdate("d/m/Y h:i:s", '1000000'); // 12/01/1970 01:46:40 You…
-
2
votes3
answers112
viewsA: How to simplify the process of verifying a certain value?
Utilise isset and use !empty (in your case) is redundant as empty does exactly the opposite of isset (basically he is !isset($var);) with the addition of the variable negation command. That is:…
-
2
votes3
answers64
viewsA: Grab piece of text in php
If you are using PDO, there is no need to perform the parse of string. The specific error comes "embedded" in Exception and in the driver connecting. PDO - Errors and error Handling PDO standardizes…
phpanswered Gabriel Heming 2,479 -
7
votes1
answer4533
viewsA: Form within Form
Not only will it not work, it will make your HTML invalid. See tag description MDN form Permitted: Flow content, but with no contained <form> Elements. You can also use the W3C validator Even…
-
0
votes2
answers1069
viewsA: Send email once a day
The way you’re trying to do it won’t work. PHP is different from other languages that run intermittently on the server. It has a cycle of beginning, middle and end. And the end is the very end. To…
-
1
votes1
answer68
viewsA: Doubt - MVC system view
Just paraphrasing the concept of View: View: responsible for all processing required for display, including object processing and rendering. The MVC has as its main focus the View. So all the other…
-
1
votes2
answers1238
viewsA: What’s the difference between using password_default and password_bcrypt?
As described in the manual, it is recommended to use PASSWORD_DEFAULT. The description informs that currently, PASSWORD_DEFAULT uses PASSWORD_BCRYPT, which would be the strongest algorithm available…
-
0
votes1
answer550
viewsA: How to use psr-4 in the Composer with different subfolders
There are some modifications to perform in your code. The Composer configuration is correct. However, your PHP codes should be changed. See your Composer configuration: "App ": "src/app/mvc/" See…
-
0
votes1
answer1016
viewsA: PDF does not generate all pages with mPDF
Since you are sending various data through a form using the POST request method, and as discussed in the comments, you need to configure the following directives in php.ini: post_max_size;…
-
8
votes2
answers163
viewsA: How to enumerate bad Smells in a software?
TL ; DR How to enumerate bad Smells in a software? Mapping and relationship (in diagrams); TDD (which is not found by mapping, appears in the Tests, see Liskov Substitution Principle); Understanding…
-
2
votes1
answer855
viewsA: For each result, a new line in php
It is noticeable that your code sins by data normalization. Although your problem is not the repetition of data between records, you end up creating repeated columns, which is practically impossible…
-
2
votes1
answer171
viewsA: What constant to declare in PDO::PARAM_ to insert date (yyyy-mm-dd h::m:s) in mysql?
For dates, always the default, which is PDO::PARAM_STR. Anyway, when you write a normal query, the date is sent as string. https://stackoverflow.com/questions/2374631/pdoparam-for-dates…
-
1
votes1
answer311
viewsA: How to gather data from two queries in a php object?
As the messages in the comments, the problem may be the use of while not be chained. To facilitate some things, I would also change the structure a little. First, it would bring only the necessary…
-
1
votes1
answer275
viewsA: How to delete data from multiple tables at the same time?
Utilize exceptions together. It is easy to verify that you are using PDO. Once using exceptions, you do not need to validate method returns PDOStatement::execute(), just keep going. You must first…
-
2
votes1
answer113
viewsA: Problem with time display
How is it possible to check in: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date The month parameter is 0 until 11, being 0 january and 11 feb: Integer value…
-
5
votes4
answers402
viewsA: How to remove parentheses of values in an array?
You can easily change using the function array_walk together with a good regular expression. array_walk - Apply a user supplied Function to Every Member of an array As the manual says, array_walk…
phpanswered Gabriel Heming 2,479 -
2
votes1
answer607
viewsA: What are the "bind" and "bindTo" methods of an Closure for?
TL ; DR Doubles the Closure using a new instance for the pseudo-variable $this and a new scope; Parameter $newthis: change the bound object (bound) to pseudo-variable $this of Closure; Parameter…
phpanswered Gabriel Heming 2,479 -
0
votes1
answer1053
viewsA: Validate form and insert into Database with PHP
Analyzing your code, it is visible the lack of validation of when a new record should be inserted or not. You see, you validate input to input. But it does not validate whether or not it should be…
-
0
votes1
answer182
viewsA: Foreach and multidimensional associative array with only one item
Solving your problem is simple, but since you didn’t post the code, I can only "hint" at what your code does. Anyway, I imagine your code is similar to this: foreach($xml['material'] as $material) {…
-
1
votes1
answer158
viewsA: How to add "Reply To" with Woocommerce Client Name and Email
The same way you enter the customer’s email: $headers .= "Reply-To: [email protected]"; You must enter the name within a pattern that you have entered yourself: $headers .= "Reply-To: Nome Cliente…
-
2
votes1
answer2822
viewsA: How do I turn a BLOB-type file into an image using PHP?
There are two ways, one is to save the binary in file (which is not interesting) and another is to add to srctag img informing that it is a binary. To do this, just add data:image/jpeg;base64,…
-
1
votes3
answers137
viewsA: How to parse the return of the __getFunctions() class Soapclient method
With a well structured ER, you do it in a few lines. First of all, it is important to understand that until the nomenclature of methods follows a regular expression:…
phpanswered Gabriel Heming 2,479 -
2
votes2
answers1280
viewsA: Insert a Date Range
Use the library Date Time for this. Date Time is a native PHP library that offers you everything you need to work with dates. In it you will find the class Dateperiod. With Dateperiod, you can…
-
0
votes2
answers144
viewsA: Improving Paging Scheme - PHP and Javascript
First of all, you need to know the current page: $currentPage = 2; After, set the number of pages you want to display: $displayedPages = 10; After, you should find the "middle ground" (it would be…