Posts by fajuchem • 581 points
35 posts
- 
		1 votes1 answer42 viewsA: Pass multidimencional array by POST, and use it in PHP to export in CSVI believe the error occurs because you pass a string in the post and not an array, so php could not identify that it is an array when it receives the data. There is a function that serves exactly to… 
- 
		1 votes1 answer32 viewsA: Query in a question bank that cannot return hitsOne way to do it would be searching the database all questions were answered by any user except the one in question, in the following query I used DISTINCT not to return repeated questions.… 
- 
		2 votes5 answers583 viewsA: How to sort json in phpCan be done using usort to sort, just implement the ordering comparison yourself, in the logic I used was to return the block with smaller unit when comparing two elements of the same block,… 
- 
		0 votes2 answers274 viewsA: Help Curl+ SleepThere is but it is not very common to do this in php. As the code runs asynchronous, you will have to make a process Fork and in it you will wait 50s while in the main process will be executed the… 
- 
		0 votes2 answers236 viewsA: PASSING PARAMETERS VIA JSON ON LARAVELReceives the Request as dependency Injection and picks up body with the method input, then spend it together when doing the post for third party api. public function… 
- 
		0 votes1 answer387 viewsA: What’s the real difference and when to use Chunk() and chunkById() from the LaravelThe difference between the two is how pure SQL is mounted, the chunkById uses the id and limit when mounting sql, while the chunk uses limit and offset for example: Using chunkById select * from… 
- 
		-1 votes2 answers535 viewsA: What is the "right" folder structure for a PHP MVC project using Vuejs?I don’t think you should worry so much about it since you’re not using any other framework together. For example if you use vuejs with symfony it will put inside the directory . /assests/vuejs or .… 
- 
		0 votes1 answer301 viewsA: Session PHP does not work in different directoriesAs it is in a different subdomain it is not found cookies, there are several solutions, can try to put before session_start: ini_set('session.cookie_domain', '.site.com.br'); If that doesn’t work,… 
- 
		0 votes2 answers580 viewsA: Laravel Update multiple lines of an arrayYour code makes no sense. Try it like this: public function atualizarEstoque($input) { $resultado = []; foreach ($input as $result) { $resultado[] = $this->produto ->where([['id',… 
- 
		0 votes1 answer32 viewsA: What is Boostrap.php and why is it used instead of index.php?The index.php is in the public directory of your application src/public/index.php, and this includes bootstrap.php, where your code is actually initialized and is located in… 
- 
		3 votes2 answers89 viewsA: Field search loses value by clicking on another pageEvery time you change pages the post data is reset so you lose the $_POST['search'], so you should save it somewhere, the easiest place is to save it in Sesssion, just putting it should already… 
- 
		1 votes1 answer234 viewsA: Foreach with tableI didn’t understand what you couldn’t do, I made a quick example of what you show, here an image showing the result. You’ll have to change the css to look the way you did, but the base is already… 
- 
		1 votes2 answers120 viewsA: Connection to a DatabaseThere are two errors in your code. It has already been pointed out by other users in the comments is that you are initiating the connection with mysql and saving it in the variable $connected (in… 
- 
		1 votes1 answer604 viewsA: How to take data from an array without using IndexYou’re trying to access the properties, which doesn’t exist in an array, there are two ways to do what you need. Form 1 - Use json as array (which is what you try to do but didn’t use right)… 
- 
		0 votes2 answers95 viewsA: Syntax error in wordpressMoult: if ( $html_head_end = stripos( $html, '/** js */' ) ) { for: if ( $html_head_end = stripos( $html, "/** js */" ) ) { Since the js code uses ' php does not know whether you want to close the… 
- 
		1 votes2 answers118 viewsA: Insert with two tablesIt was unclear if the table payments possesses a key Foreign of the student, by Insert does not seem to have, but may be the student situation? First you change the function register to return the… 
- 
		0 votes3 answers444 viewsA: How to deal with errors in case of a failure in simplexml_load_file in PHP?This should work here, but if you want something more robust I suggest using a third party component that loads xml. // nescessário pra consegui pegar os errors libxml_use_internal_errors(true);… 
- 
		1 votes2 answers32 viewsA: Search with regular expressionsIf $loopurl needs to be contained exactly the same within $urlHost can be used strpos. Example: function verificarParametro($loopurl, $urlHost) { return (bool)… 
- 
		2 votes1 answer50 views
- 
		0 votes2 answers48 viewsA: Error in form validationHello, one possible solution without restructuring all the code is to add a div on top of the form and php return the script by adding the message. html code // ... <div… 
- 
		1 votes1 answer150 viewsA: Reduce function in controllerHi, I gave an improved code, no syntax errors, but I would have to confirm the logic of the wheres in select, it was not very clear how it is to be. $marcas = CelularMarca::orderBy('nome',… 
- 
		1 votes1 answer29 viewsA: Reading Json PHPHi, if you have a json why not use json_decode. Example: $json = '{ "website_purchase_roas": [{ "action_type": "offsite_conversion.fb_pixel_purchase", "value": "6.479003" }] }'; $array =… 
- 
		0 votes2 answers124 views
- 
		1 votes1 answer71 viewsA: Search for the nl2br function or concatene: print "you can Eat: $Dish"." <br />";The problem is in a Unicode Character used within php tags depending on the IDE or editor you use it may have become "invisible". The Character is this one "<200b>". Here is an image showing… 
- 
		3 votes2 answers59 viewsA: PHP script incrementYes, it is possible but you will have to save the number somewhere(database or even a file) Example saving the number in a file: // script.php $numero = file_get_contents('arquivo_salva_numero'); if… 
- 
		4 votes1 answer163 viewsA: Isset does not workIn this file here: <div> <? php // <<<<<<<< if(isset($_POST['cpf'])){ echo "<table>"; echo "<tr>"; echo "<th>NOME</th>"; //... </div>… 
- 
		2 votes2 answers549 viewsA: I cannot extract the information from Json on LaravelWith json_decode should work, make sure you are using it the right way? Example: $json =… 
- 
		1 votes2 answers739 viewsA: Not registered in PHP Mysql databaseChange the line: $result = "INSERT INTO strains ('nome', 'tipo', 'thc') VALUES (:nome, :tipo, :thc)"; To: $result = "INSERT INTO strains (nome, tipo, thc) VALUES (:nome, :tipo, :thc)"; In addition… 
- 
		0 votes1 answer58 viewsA: Check if it is a valid accountDo you want to solve the problem by php or mysql? Also, I believe that there is no what you want, you will probably have to make a series of validations. mysql: select if(colA >= 0,… 
- 
		0 votes1 answer62 viewsA: Recording of Logs in linuxWhen the file cannot be written for reasons of permission php will send a Warning. What may be happening is php is not allowed to write inside the "log" directory. A solution would be to use the… 
- 
		1 votes2 answers92 views
- 
		0 votes1 answer226 viewsA: Foreach array and create a name for array with same ID$result = []; foreach ($arrays as $key => $row) { $result[$row['teamID']][] = $row['username']; } The result will be like this: array( 1151 => array( "iLilithZ", "iLilithZ", ), 1111 =>… 
- 
		0 votes4 answers72 views
- 
		0 votes1 answer73 viewsA: Standard phpmyadmin string search sqlHello, one possible solution is you run an SQL to fetch the data you want, for that go to the SQL tab of phpmyadmin and run the following query: SELECT * from nome_da_tabela WHERE content like… 
- 
		2 votes1 answer45 viewsA: PHP - Get Select valuesit was not very clear what you want, but I will try to make an example for both cases. case 1: First if you want to do something different for each value, the best way is to use swich and create a…