Posts by Augusto • 620 points
15 posts
-
1
votes1
answer87
viewsA: Why does the minus sign button (remove) not work when clicking it?
Alter your javascript, using the unbind to remove the event click, and put inside the add function, so that every time you create a new element it removes the events and creates again. I also added…
-
2
votes2
answers950
views -
2
votes2
answers211
viewsA: How can I add an array within an array?
You can also change your code to use the $idAposta as an index. $array = array(); while($dado = $pegar->fetch(PDO::FETCH_ASSOC)) { $valor_apostado = $dado["valor_apostado"]; $valor_final =…
-
5
votes2
answers282
viewsA: Validate the return of select PHP
You can do it like this $result = $stmt->fetchAll(); if(count($result) > 0){ ... }
-
0
votes1
answer531
viewsQ: Best Mysql performance (one table or multiple tables)
What has better performance (or how best to do) in a Mysql database, multiple tables, for example 'purchases_cliente_01, purchases_cliente_02' or a 'purchase_clients' table with the client ID ?…
-
1
votes4
answers978
viewsA: Loop autoincrementing date
You can do it like this <?php $parcelas = 12; $data_inicial = '2017-01-31'; for ($i = 1; $i <= $parcelas; $i++){ echo $data_inicial."<br>"; $d = new DateTime( $data_inicial );…
-
3
votes1
answer146
viewsA: PHP return function
Follow the solution below by taking the result of the array $row public function getUrlcliente($cliente_id) { $parametro = "cliente_id=" . (int)$cliente_id; $url_externa =…
-
3
votes3
answers131
viewsA: Why am I only getting the first word from the database field?
Try it like this, you weren’t putting quotes on value. echo '<form action="" method="post"> <input type="text" name="pid" value="'. $row["product_id"].'" ><br> <input…
-
6
votes2
answers833
viewsQ: Show use of Processor
I am trying to show the use of the server processor with PHP. Server is Windows with IIS. I’ve tried to use : exec("wmic /node:localhost path Win32_Processor where DeviceID='CPU0' get…
-
5
votes2
answers1944
viewsA: Remove comma from the last foreach value in PHP
You can also use implode(",", $array); in place of foreach.
-
4
votes1
answer594
viewsA: Compare array values with variable
I think this might help you. I found Stack Overflow. $values = array(1000, 1000, 3000, 5000); $expected = 4000; $len = count( $values ); for( $i = 1; $i < pow( 2, $len ); $i++ ) { $soma = 0; $set…
-
0
votes1
answer57
viewsA: Alphanumeric generator in form
function rand_sem_num_repetido($qtd_numeros,$limite_min,$limite_max){ $index = array(); for($i=0;$i<$qtd_numeros;$i++){ $aux=rand($limite_min,$limite_max); if($i>=1){…
-
3
votes2
answers2189
viewsQ: Convert Date dd/mm/yyyy to ISO 8601 format (yyyy-mm-dd)
I have a field called maskedTextBox2 in C# Windows Form, which contains a date mask in the format dd/mm/aaaa. How can I convert this string format aaaa-mm-dd to save to Mysql database, which uses…
-
1
votes4
answers349
viewsA: Every N repetitions display X in PHP
I think that solves your problem: <?php $aux = 0; do { $aux++; if($aux >= 4){ $nomeDaClasse = 'classe'; $aux = 0; } ?> <div class="<?php echo $nomeDaClasse;?>">…
-
1
votes1
answer127
viewsA: Registration in the BD with pre-filled fields
I don’t know if I understand you but if what you want is just to insert the email is like this: if (!$this->db_connection->connect_errno) { $user_email =…