Posts by Fabio William Conceição • 415 points
44 posts
-
0
votes2
answers675
viewsA: Run Python command with Selenium called by PHP through Apache
A few thoughts before we move on: If the script is in Python why the whole page is not already in Python? If the page is in PHP then the script is not in PHP? However, with years of experience we…
-
-1
votes2
answers81
viewsA: Add data from "pivot" table of relation Many to Many
Is portable? If yes, you do not need to suffer much for it in your model you will create the following attribute: protected $appends = [ 'soma_total' ]; Still in your model you will create the…
-
0
votes1
answer9
viewsA: problem uploading production image with php
File/ folder permissions do not let you add a file. Also check what type of environment you are using, normally linux based environments tend to use a temporary folder (tmp) before effectively…
-
0
votes4
answers44
viewsA: I would like to know how to add html div through pure js
You lacked a little effort and search, in a quick google search you has this example, this example and also this example. Before you ask a question on Stackoverflow always do a detailed search to…
-
0
votes1
answer50
viewsA: Check products with ajax and php for sales page
In your own example the error is implicit in your problem that it is not finding the index 'code'. Accessors should never be used directly if your array / object is fully changeable and dynamic. So…
-
0
votes2
answers84
viewsA: Group Messages by PHP date, Jquery
My suggestion is that you use PHP’s already native functions for this, here in this PHP documentation link you will find several examples of using native PHP functions for both strings, arrays,…
-
1
votes1
answer29
viewsA: How to make a select and a "Sub Select" faster (in PHP)
If you want to make sub selects or selects where there is high complexity of the query maybe it is better to create a manual query since many frameworks they do not make complex selects and just…
-
0
votes3
answers588
viewsA: Recover $_SESSION with Ajax
This is not incorrect, but it is not a good practice at all because the $_SESSION and everything it encompasses within the object of it should be accessed only by the scope of the context itself…
-
-4
votes2
answers985
viewsA: How to convert stdClass to array recursively?
Depending on the PHP version you don’t need to create a function or anything like that, if your stdClass is just a scalar type (pure objects) you can simply use PHP’s own casting to do this (only…
-
0
votes1
answer82
viewsA: How do I convert the php array values to the "uint" type of C#?
You can not convert up because the value Unit do C# is a specific value of the language constructor and compiler itself as are some things in PHP as well (Iterator, Exceptions among others). When…
-
0
votes1
answer55
viewsA: How to pass the value of a PHP variable to a fixed place?
There are two ways to do this. First you taking the tag off <br /> which would prevent your loop from causing the value to jump from line, however, if you want the values all in the same…
-
1
votes3
answers1289
viewsA: Error when launching Reset
You have to create a folder called public with the file index.html. Here is the structure of the HTML file you have to create: <!DOCTYPE html> <html lang="en"> <head> <meta…
-
-2
votes2
answers418
viewsA: Is it bad practice to use empty interfaces?
It’s neither a good nor a bad practice, it’s just a practice, the above answer says a lot and I’m just adding mine as an add-on attempt to open your head to other ideas. As stated, an interface will…
-
0
votes1
answer91
viewsA: How to mock the class without passing parameter
There are some ways to do this. Since Phpunit uses test classes to create them, so you can use the conventional object orientation paradigm by creating a constructor for her class and make the…
-
0
votes1
answer129
viewsA: PHP - Merge array with PHP multidirectional array
There are several possible operations with arrays, several. For example you can use the operator + to do this, example: $array = [1,2,4]; $array_b = [5,6,7]; $array_sum = $array + $array_b;…
-
1
votes1
answer170
viewsA: Error installing Composer and Variable
Isn’t that. What is happening is that the extension of this DLL is probably disabled, for conscience-free try to look in your php.ini if all the necessary extensions are enabled and take advantage…
-
0
votes1
answer50
viewsA: Help with view
From what I read in the comments you are using version 4.2 of the Standard (does not consider gives an upgrade?). Try it this way: public function index() { return…
-
0
votes1
answer86
viewsA: I need to return this JSON with Laravel eloquent
Hi, In your control you can return using Sponse. Example: $dados = new MinhaModel(); return response()->json($dados->get()) I’m implying that you already have models, are using Eloquent and…
-
0
votes3
answers232
viewsA: Upload PHP files
Hello, I came through the group PHP Brazil Whastapp you posted, I’m William. Let’s go to your aid. Then by error what indicates is that the upload is not finding the folder, so first you have to…
-
-1
votes1
answer229
viewsA: mysqli_insert_id() is returning 0 when used inside an insert
Has a { lost in code ,is just a piece of the correct code? Another thing you should take into consideration is to see if all your query data meets the table requirements for insertion (check if you…
-
1
votes1
answer1512
viewsA: How to load edit modal dynamically using Laravel?
Your problem is occurring here: @foreach($ecategories as $ecategory) // listando os modals de cada registro <div class="modal fade" id="edit{{$ecategory->id}}" tabindex="-1" role="dialog"…
-
1
votes2
answers1365
viewsA: Consulta Laravel Eloquent
To generate this query you have 2 ways to do it. In case I will assume that the name of your table is positions even, but what I will try to explain to you is valid for any table you want to use…
laravel-eloquentanswered Fabio William Conceição 415 -
1
votes1
answer154
viewsA: Decrease memory usage of recursive functions in PHP
Personal thanks to all who responded and tried to help. But in English stackoverflow have already given me a good solution to the problem, in case someone is going through the same problem just…
-
0
votes1
answer154
viewsQ: Decrease memory usage of recursive functions in PHP
I have a recursive function in PHP where it loops into an api where it only allows you to retrieve 200 records at a time. However as this API has a very high response latency we decided to use a…
-
1
votes1
answer114
viewsA: Create BD via PHP => Access Denied!
You have how to share an error screen print? Usually this error occurs in situations: You have used the incorrect database access credentials (host, user and/or password). Or for some reason only…
-
0
votes6
answers10949
viewsA: How to measure code performance in PHP?
You can use Xhprof (http://pecl.php.net/package/xhprof). Originally it was developed by facebook, I think an excellent tool and has a very user friendly interface.…
-
2
votes2
answers5148
viewsA: How to remove value accentuation in Mysql
The above answer already helps you enough, but if you have one database with many tables, will have to do it manually, which frankly, is a lot of work. Always before you start deploying a Mysql…
mysqlanswered Fabio William Conceição 415 -
0
votes2
answers421
viewsA: More than one table in the query - LEFT JOIN SQL
Try using group_by that so it elects the repeated columns.
-
0
votes3
answers1488
viewsA: Foreign Key in another database?
On your first question, it is not possible to use any foreign key on two different bases, no Mysql engine (database I know, myISAM and etc... I can’t tell you if another database based sql allows)…
-
-3
votes3
answers2583
viewsA: include, require inside functions methods
As of version 5.0 there are no problems, as commented above, but it is a bad practice and you are importing a whole file into your code snippet, and if you are working with classes you will have…
-
0
votes2
answers172
viewsA: Query Performance in Mysql
The difference in performance between the two queries are minimal, they are milliseconds thing, but you have to keep in mind how the answer above said "better one queries than two", because two…
-
0
votes2
answers160
viewsA: What happens when we run PHP scripts with long tasks?
The script itself does not lose performance because it is not changeable after interpreted by apache (whatever other php server) and compiled, so the code will be the same, what makes it lose…
-
1
votes4
answers913
viewsA: Is multiple includes bad for performance?
A include can disrupt performance because you can make unnecessary file includes at times of code that you won’t even use. The guideline is to study your type of system well and if you have…
-
0
votes2
answers984
viewsA: Codeigniter session expiring after an action
You have to change in application > config > config.php $config['sess_time_to_update'] = 172800; // 48 horas por exemplo Try user sessions using database as stated in the documentation, it is…
-
-2
votes2
answers1078
viewsA: Increase timeout of dblib connection with PDO
You can use $pdoConnection->setAttribute(\PDO::SQLSRV_ATTR_QUERY_TIMEOUT, 10); But you can insert this directly into the connection string query with your database. Example with mysql: $dbh = new…
-
0
votes2
answers517
viewsA: Fielderror: Relation Fields do not support nested lookups
Try not to use alias in your joins because depending on your database engine or database version it does not apply to correlates. If you use alias always put the syntax as in front of the table name…
-
0
votes1
answer70
viewsA: Using javascript array within $("tr:contains('"+array+"')")
Solution: //GET DATES INTERVAL FUNCTION function getDates(startDate, stopDate) { var dateArray = new Array(); var currentDate = startDate; while (currentDate <= stopDate) { var newDate =…
-
-1
votes2
answers4213
viewsA: Convert hour format in seconds
And very simple only you use $segundos = strtotime('1970-01-01 '.$horario.'UTC'); and that’s it, it’s done.
-
-1
votes2
answers1153
viewsA: Left Join with multiple fields from the same table
When you make a left Join it will automatically give the results of that junction having lines or not, because the left Join it works as a junction of the tables but meeting its condition as if it…
-
2
votes2
answers1174
viewsA: How to do more than one select in the same query?
Try using subquerys and / or joins if they are relational tables, and don’t forget to filter everything by group by if you have replicated data, but keep in mind the structure of your database,…
-
3
votes1
answer70
viewsQ: Using javascript array within $("tr:contains('"+array+"')")
I have 3 functions, to make the date range filter in a range of 2. So, I have a start date and an end date, and within these two dates he searches a table within his trs and tds such dates that will…
-
2
votes2
answers292
viewsA: Problem with recursive function in array
See if it works for you: function search($haystack, $needle, $index = NULL) { if (is_null($haystack)) { return -1; } $arrayIterator = new \RecursiveArrayIterator($haystack); $iterator = new…
-
-1
votes4
answers82
viewsA: Div occupying all the height of the page
I don’t quite understand, you want to let it take up 100% of the page? If it’s try the code: .suadiv{ heigth:100%; }
-
3
votes3
answers847
viewsA: Does merging PHP files into one only increase performance?
Yes, it increases performance, but the end result is derisory, in fact not even worth the work. Because you should remember that in the future you will need to take the minification that you made in…