Posts by Wees Smith • 2,778 points
154 posts
-
0
votes1
answer59
viewsA: How to perform this Select?
I believe using the function MySQL calling for FIND_IN_SET() you can achieve the result, once it will fetch the gender, in the tabela_c, within a string_list, genres of the tabela_b: $sql=" SELECT…
-
1
votes1
answer122
viewsA: Conversion of SESSION Mysql to SESSION into PDO
First you create the connection to the database: $dbname="nome_do_banco_de_dados"; $dbuser="nome_do_usuario_do_banco"; $dbpassword="senha_do_usuario"; try{ $conn=new…
-
0
votes2
answers156
viewsA: PHP does not recognize connection as parameter
@Leandro is actually accusing that only 2 arguments were passed and the expected are 3, you are calling the function Login::login thus: $result = Login::login($usuario, $senha); But it’s defined…
-
2
votes1
answer24
viewsA: Error when executing query within function
One solution to your problem is to create a function with the connection and call it within the (s) other(s) function(s): function conn(){ $conn = new mysqli('localhost', 'root', '', 'banco'); if…
-
4
votes3
answers67
viewsA: Insert into database table with second form
Ajax() First the ajax() need to send information to distinguish in PHP what action you want to take: $(document).ready(function(){ $(".btn_contact").click(function () { var id =…
phpanswered Wees Smith 2,778 -
3
votes2
answers516
viewsA: Insert with PDO and INNER JOIN
Case time_id already exists, you make a INSERT with SELECT: INSERT INTO pessoa ( nome, cidade, telefone, time_id ) VALUES ( :nome, :cidade, :telefone, SELECT meu_time FROM tabela WHERE…
-
3
votes1
answer996
viewsA: Secure Pay API to pick up payment status by ID
Basically you’ll do it: $curl=curl_init("https://ws.pagseguro.uol.com.br/v3/transactions/{{codigo-transacao}}?{{credenciais}}"); curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,false);…
-
2
votes1
answer101
viewsA: Run addslashes function on all Insert fields
Makes a foreach() before adding the addslashes(): foreach ($dados as $key => $value) { $dados[$key]=addslashes($value); }
-
0
votes1
answer2464
viewsA: Insert, add and display value (in real) using PHP and Mysql
First, the field DECIMAL Mysql requires exact accuracy, by my option I use FLOAT. Then the value that will be saved must contain a maximum of one . separating the decimals, 1234.56 for example, for…
-
2
votes1
answer4478
viewsA: PHP Deprecated: Non-static method should not be called statically in
The problem is a warning that the function is not static: function _t($word) { return TTranslation::Translate($word); } That’s how you called the function Translate() it represents a static…
phpanswered Wees Smith 2,778 -
2
votes1
answer473
viewsA: record time in Postgresql database
Your problem is here: $horafinal = date('H:i:s',$datafim); $horainicio = date('H:i:s',$dataini); try like this: $horafinal = date('H:i:s',strtotime($datafim)); $horainicio =…
-
1
votes1
answer593
viewsA: How to send an HTML page in the body of an email with PHP ?
Using the options of header of the email: $headers='Content-Type: text/html; charset="utf-8"'; You create a page html with css for emails. Here’s a question from the English OS about that And here’s…
phpanswered Wees Smith 2,778 -
1
votes2
answers29
viewsA: Difficulty finding values in an array
The structure of your array is like this: Array ( [0] => Array ( [nome] => DIDAXIS1.png ) [1] => Array ( [nome] => DIDAXIS2.png ) [2] => Array ( [nome] => DIDAXIS3.png ) [3] =>…
-
1
votes1
answer463
viewsA: Calculate values for each column of an html table
First of all, the attribute id is something that should be unique, so instead of id use class: <tr> <th scope="row"> <? echo $row['numero_doc']?> </th> <td…
-
0
votes1
answer225
viewsA: How to capture a $_FILE file name and print to an echo
The point is that using <input type="file" multiple="multiple" name="upload[]"> the PHP will receive the array like this: $_FILES['upload']['name'][n] Where n is equivalent to the number of…
phpanswered Wees Smith 2,778 -
1
votes1
answer76
viewsA: How can I put an if in this mysql search when no results return?
Try it this way: if(mysqli_num_rows($salvar) > 0){ while ($linhas = mysqli_fetch_array($salvar){ echo "Nome: ".$linhas['nome']."<br>"; echo "Nome: ".$linhas['telefone']."<br>"; }…
-
0
votes2
answers351
viewsA: Request via GET
Try it this way: $sql = "SELECT * FROM pagcabecalho, menu, produto WHERE titulo LIKE :pesquisa"; $resultados = $pdo->prepare($sql); $resultados->bindParam(':pesquisa', $buscar,…
-
0
votes3
answers101
viewsA: Form data is not sent to the database
Try it this way: $execute=$pdo->prepare("INSERT INTO tarefas (nome,descricao) VALUES ('$nome','$descricao')"); $execute->execute(); echo "Tarefa enviada<br/><a…
-
0
votes4
answers209
viewsA: count equal text from php database
I guess this is it then @Ana: $verificar=mysqli_query($link," SELECT COUNT(CASE WHEN classificacao = 'verde' THEN classificacao END), COUNT(CASE WHEN classificacao = 'vermelho' THEN classificacao…
-
2
votes1
answer177
viewsA: How to insert the button pressed in the database
Setting the color in value from the button instead of name: <input type="submit" name="botao" class="verde" value="verde"> <input type="submit" name="botao" class="amarelo"…
-
0
votes1
answer121
viewsA: Truncate PHP integer value
If you want a 1 digit number only, you can do so: $novoservico = '402,02'; $valor_redondo = $novoservico[0]+1; echo $valor_redondo; He will always print the next number, but if it is int really:…
-
2
votes1
answer176
viewsA: Fatal error: Call to Undefined method mysqli_stmt::bindparam() PHP || MYSQL
The correct is: bind_param() Reference of bind_param mysqli…
-
5
votes3
answers456
viewsA: Check that the value of $_GET is an Integer number
The method HTTP GET returns an array of strings passed by url through function urldecode. Then I suggest other forms of verification in case $_GET['PG'] be a number: if(is_numeric($_GET['PG'])) Or…
phpanswered Wees Smith 2,778 -
3
votes2
answers167
viewsA: What’s wrong with this mysql data entry code?
I suggest reading the PHP documentation about the class Mysqli and/or PDO Mysqli PDO But basically you need to start the connection to the database, I’m talking in case it doesn’t exist, but for you…
-
1
votes1
answer330
viewsA: Warning: Illegal string offset 'id_mol_comp' in
Try it this way: foreach($_session['itens'] as $produtos => $quantidade){ $select=$con->prepare("select * from stock_comp where id=:id"); $select->bindparam(':id',$idproduto);…
-
1
votes1
answer69
viewsA: No matter the products for the PHP cart || MYSQL
Here’s a problem, you’re putting the variable $row in quotes without need: <a class='fa fa-cart-plus' style='font-size:30px' href='carrinho.php?add=carrinho&id=".$row['id_mol_comp']."'> To…
-
0
votes2
answers213
viewsA: Validation POST php array
In the PHP, if the checkbox is marked it will appear with its respective key, so just give unset() in the array $_POST who has the key with the checkbox marked, thus: if(isset($_POST['valida'])){…
-
0
votes3
answers163
viewsA: Clear campo select
I think you can do it: function buscarMedicos(especialidades) { $.ajax ({ url: 'select.php', type: 'POST', async: true, dataType: 'json', data:{'especialidades' : especialidades}, success: function…
-
1
votes3
answers243
viewsA: Search 3 unrelated Mysql tables
try like this: SELECT * FROM tabela1 WHERE tabela1.NomeUsuarios = 'Davi%' UNION SELECT * FROM tabela2 WHERE tabela2.NomeUsuarios = 'Davi%' UNION SELECT * FROM tabela3 WHERE tabela3.NomeUsuarios =…
mysqlanswered Wees Smith 2,778 -
0
votes2
answers42
viewsA: CONCAT de querys DELETE?
If I’m not mistaken: $string1 = " DELETE planos.*,fotos.* FROM planos,fotos WHERE planos.idPlano = '$idPlano' AND planos.idPlano = fotos.idPlano "; $this->conexao->query($string1); If there…
phpanswered Wees Smith 2,778 -
0
votes1
answer47
viewsA: Set which value will be stored in a PHP variable to be saved to the Database
When you send the form to PHP it will create the keys of the array $_POST according to the names of <input>s: $tipoproblema=$_POST['tipoproblema']; $outro=$_POST['outro'];…
-
1
votes1
answer26
viewsA: Make registration popup made!
Changes the header(): if ($con->query($criar)) { echo '<script type="text/javascript">if(confirm("Cadastro realizado com…
-
1
votes2
answers179
viewsA: JS - Multiply and Show in text
Through this example Jquery you can suit your needs: <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script…
javascriptanswered Wees Smith 2,778 -
1
votes3
answers1030
viewsA: HTML / CSS - input date height width
Using CSS: <style type="text/css"> #date{width:500px;height:500px} </style> <input type="date" name="date" id="date">
-
2
votes2
answers630
viewsA: Regex or Replace in Jquery
Replacing the <span> for <input> and using the plugin Jquery.Mask you can do it: <div> <input type="text" name="number" id="number" value="1195555666"> </div>…
-
0
votes1
answer59
viewsA: PHP is reading the last array key
Within the foreach() he is defining the variable $teste at each loop, then only the last value would be returned in the echo after the loop, try this way: $arquivo =…
phpanswered Wees Smith 2,778 -
1
votes2
answers65
viewsA: Error calling Function on my page
In the functions you want to call, there is already the call to the element that will be filtered and does not have the parameter in which would be informed which element should be filtered: var…
-
1
votes1
answer138
viewsA: Change form when renaming in combobox
Class names were wrong: $(".hide-section:not(:first)").hide(); $('#mudar_produto').change(function(){ $('.hide-section').hide(); $($(this).val()).show(); });
htmlanswered Wees Smith 2,778 -
3
votes2
answers60
viewsA: PHP version conflict
Try to do it this way: $json = json_encode(array( 'email_address' => $email_popup, 'status' => 'subscribed', 'merge_fields' => array( 'FNAME' => $nome_empresa_popup, 'CIDADE' =>…
phpanswered Wees Smith 2,778 -
-1
votes1
answer33
viewsA: Creating the order number
You can create an encrypted key using the functions hash() and microtime(): $codigo=hash('crc32',hash('sha512',microtime())); It creates a sha512 of microtime() and then a crc32 which is a smaller…
phpanswered Wees Smith 2,778 -
-1
votes4
answers283
viewsA: Toggle header colors based on menu Hover
Assigning an id for each color: <li id="Cinza"><a href="#">Header Cinza</a></li> <li id="Verde"><a href="#">Verde</a></li> <li id="Azul"><a…
-
1
votes1
answer261
viewsA: Pull data from a table for inputs on the same page
First you need to reset the name of input that will receive the ID of the product that is the same as the product name Second, assign an identifier to each line, I thought it would be easier so:…
-
3
votes1
answer217
viewsA: How to insert a row in the sql table when clicking the button?
The $.ajax(): $('#ID_DO_BOTAO').on('click',function(){ $.ajax({ type:"POST", url:"SEU_ARQUIVO.php", dataType:"Json", data:{'favorito':'favorito'}, success:function(a){ //retorno do php, ou um reload…
-
2
votes1
answer313
viewsA: Close dropdown with ESC key
Using an event with keyCode: $(window).on('keypress',function(event){ if(event.keyCode==27){ $("#jq-dropdown-1").toggle(); } });
jqueryanswered Wees Smith 2,778 -
0
votes1
answer128
viewsA: how to change the date format to d/m/a in php wamp
With PHP: $sua_data_atual='2018-05-19'; echo date('d/m/Y' strtotime($sua_data_atual)); Retouching 19/05/2018. Function reference date() Function reference strtotime()…
-
0
votes3
answers687
viewsA: How to join values in common php array?
You can do it like this: $codigo=$valor=0; for ($i=0; $i < count($vetor); $i++) { $codigo+=$vetor[$i]['codigo']; $valor+=$vetor[$i]['valor']; } unset($vetor);//para eliminar o array vetor…
-
1
votes1
answer31
viewsA: Update does not generate errors but does not update the table
Field names, commas, and WHERE in the wrong place: $QueryClientUPD = mysql_query(" UPDATE clientes SET data_nascimento = '$DATANASC', nome = '$NOME', nome_fantasia ='$nome_fantasia', responsavel =…
-
2
votes1
answer246
viewsA: Create and destroy session
Creating a restriction level in the users table, for example, you get the result. When the user logs in, you search for this level of access and create the session with it:…
phpanswered Wees Smith 2,778 -
0
votes2
answers1383
viewsA: How to add 100% height to a Bootstrap 4 column
Using Bootstrap 4.0, has the classes h-: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Page Title</title> <meta name="viewport"…
-
0
votes1
answer56
viewsA: Temporary reserve
You can use the EVENT of MySQL, for this first need to activate the feature in your database: SET GLOBAL event_scheduler = ON; Create the event: CREATE EVENT mudar_status ON SCHEDULE AT…