Posts by thedogdev • 181 points
8 posts
-
1
votes2
answers4627
viewsA: Removing Characters from a String (JS)
You can use the function replace along with a regular expression. Example: const str = '10,000.00' const strNum = str.replace(/[^0-9]/g, '') console.log(strNum) // 1000000…
-
3
votes2
answers107
viewsA: Vue.js: how to relate values in an array of strings?
You can add a @click in its input where it calls a method to check its rules and update the array of options selected with the function filter in accordance with those rules. Follow codepen link…
-
2
votes2
answers354
viewsA: How to generate an array of years dynamically containing the index as the year and the value as the year itself?
You can make it that way too, very simple. Code: <?php $rray = array(); $ano = '2015'; while ($ano <= date('Y')) { $rray[$ano] = $ano; $ano++; } print_r($rray); ?> Exit: Array ( [2015]…
-
0
votes7
answers874
viewsA: Extract Array content for PHP variables
A simple way is to do: $var = $array["valor da chave"]. An example, where $array would be the name of array in your code. Code: <?php $array = array ( "InvoiceIdOut" => 879,…
-
0
votes2
answers1197
viewsA: how to insert data into two tables at the same time
You forgot to pass all the necessary parameters to the function mysqli_query. Change these lines: mysqli_query( $query1 ); mysqli_query( $query2 ); To: mysqli_query($link, $query1);…
-
5
votes2
answers123
viewsA: Find words between characters { }, and remove text in PHP?
A very simple example using str_replace. Code: <?php // 1 = Masculino, 2 = Feminino. $codGenero = 1; $comoesta = "{A,O} {portador,portadora} é {o,a} mais {especializada,especializado} para o…
-
1
votes2
answers1526
viewsA: PHP - List files in a directory
Example to filter only files with extension .html. It will return an array with the name of the files, where path is the path of the folder where your files are. Code: <?php $path =…
-
3
votes4
answers1609
viewsA: Mysqli_fetch_row() expects Parameter 1 to be mysqli_result
In the example below I put the clause WHERE id = 1, you must put the clause WHERE according to your need, if not put, will change all records. Code: <?php if (!isset($_SESSION)){session_start();}…