Posts by Costamilam • 9,556 points
509 posts
-
0
votes1
answer195
viewsA: Concatenate WHILE
I believe you want something like this: $nestedData[] = $row["nomerota"]; $tr="<select size='1'>"; while ($row = mysqli_fetch_array($resultado)) { $tr.= "<option…
phpanswered Costamilam 9,556 -
4
votes1
answer56
viewsA: check if data exists in the database
You must make a SELECT COUNT(*) in the database to check that users have that field, for example: SELECT COUNT(*) FROM pessoa WHERE cpf = $cpf; This will return how many people have the specified…
phpanswered Costamilam 9,556 -
0
votes1
answer200
viewsA: Life Cycle of an Activity. Doubts
The methods related to the life cycle of an Activity are called automatically, even if you do not see them explicitly in their code they exist, this is the basic skeleton of an activity: public…
androidanswered Costamilam 9,556 -
1
votes2
answers319
viewsA: How to validate value entered in text field with php?
To validate in PHP use the function preg_match, for example: <?php // The "i" after the pattern delimiter indicates a case-insensitive search if (preg_match("/php/i", "PHP is the web scripting…
-
1
votes1
answer1785
viewsQ: Definition of firebase security rules
How can I define a safety rule that: Allow read and write access to recipes if the logged in user is the user who registered it Allow read access to recipes if the tipo for true Do not allow read…
-
2
votes1
answer919
viewsA: Sort PHP table
I use this Sorttable, example: <html> <head> <title>Sorttable</title> <!-- Importa o JS --> <script type="text/javascript"…
-
2
votes2
answers490
viewsQ: Organization of PHP code
I’m working on a PHP project where several tables relate to several tables, so how should I organize the controllers and Daos, split files by table - employees, sales, customers, ... or group by…
-
0
votes2
answers913
viewsA: Sort data by date in Firebase
Actually it is ordering correctly, but it will not have the desired result because it is ordering like a string not like a date in the BR format, if you change the format to yyyy-mm-dd, will have…
-
0
votes1
answer421
viewsA: Change structure firebase bank
I was able to create a code with Javascript to change the structure of the bank, but because the firebase is asynchronous I needed several Gambi... To start I created a base with some users and…
-
2
votes1
answer418
viewsA: From Json Object to Listview
First change the class that receives and stores JSON in String to create a String Arraylist: ArrayList<String> items = new ArrayList<String>(); JSONArray JA = new JSONArray(data);…
-
0
votes1
answer36
viewsA: Add form data to an array
Paulo Imon already explained why not to store then a solution would be to store this data in a session: <?php session_start(); include "Product.class.php"; if(empty($_SESSION["produtos"]))…
phpanswered Costamilam 9,556 -
1
votes3
answers46
viewsA: Group separate table records
You can try something like this: SELECT * FROM ( (SELECT nome FROM `cliente` WHERE ativo = 1) as c, (SELECT nome FROM `fornecedor` WHERE ativo = 1) as f ) WHERE c.nome = f.nome…
sqlanswered Costamilam 9,556 -
2
votes1
answer102
viewsA: Run form by clicking a browser button
With Jquery you can do as Edson mentioned in the comments: $('input').on('change', function(){ $('form').submit() }) And with pure Javascript:…
-
0
votes1
answer79
viewsA: consultation of datepicker dates
I would make a SELECT so for fields with date column or datetime: SELECT * FROM tabela WHERE DATE_FORMAT(coluna_data, '%d/%m/%Y') = $data DATE_FORMAT to format in the same pattern that comes from…
-
0
votes1
answer421
viewsQ: Change structure firebase bank
I made a question here at Sopt on how to do a search on the firebase Realtime database, and @Rosáriopereirafernandes suggested changing the structure of the database Ancient structure: {…
-
1
votes1
answer673
viewsQ: Take column from HTML table
I searched here at Sopt, but I didn’t find this question... How to get all values of a column in HTML? I just found how to get value from a cell, the idea is to then make a filter with the same…
-
-1
votes2
answers11323
viewsA: View data from a Json file in HTML
To filter the data you can use search: //Sintaxe: var teste = 'exemplo' teste.search('ex') //Retorna 0 que é a posição da primeira ocorrência do filtro teste.search('Ex') //Retorna -1, ou seja, não…
-
1
votes1
answer6454
viewsA: Receive array method POST form
Another way to do it: Change name="array[][id]" for name="arrayid[]" and name="array[][nome]" for name="arraynome[]", in PHP: $id = $_POST['arrayid']; $nome = $_POST['arraynome']; for($i = 0; $i…
-
0
votes1
answer109
viewsA: Send checkbox values chosen by email
$turma = stripslashes($_POST["turma"]); //Isso retorna um array $turma = stripslashes($_POST["turma"][0]); //isso retorna o valor da primeira checkbox se ela estiver marcada Then change your code…
phpanswered Costamilam 9,556 -
2
votes1
answer67
viewsA: Conflict of forms
If both forms are sending data via POST, when making such a verification if ($_SERVER["REQUEST_METHOD"] == "POST") the two forms enter, put another condition to the if(), for example Form 1:…
phpanswered Costamilam 9,556 -
2
votes3
answers70
viewsA: Non-responsive image
Not to repeat use: background-repeat: no-repeat; Or background-size: 100% auto; //Largura e altura respectivamente
-
0
votes2
answers937
viewsA: View and modify items in the database with php
The functions mysql_* are obsolete and have been removed in PHP 7, butmysqli_* is similar, I’ll show you an example with mysqli... Connection: //inicia uma conexão com o banco, note que aqui ja é…
-
0
votes1
answer35
viewsA: Change defined variable and receive new value via form
No form sends the text of the new page to php by post: <form method="post" action="caminho/config.php"> <input type="text" name="titulo"> </form> On the config.php page checks for…
-
7
votes1
answer332
viewsA: As defined in the database the confirm password field
No need to do anything nobanco this is just a comparison in php: if ($_POST["senha"] == $_POST["confirmar_senha"]) { //continua com o cadastro.... } It’s nice to do this validation on the front end…
-
1
votes1
answer1220
viewsA: SQL to find number within a range of two Mysql table fields
Check that your between syntax is correct: SELECT * FROM tabela_nome WHERE $valor BETWEEN num_min AND num_max; There is also this option: SELECT * FROM tabela_nome WHERE $valor > num_min AND…
-
0
votes2
answers56
viewsA: How to leave the four in a row?
Exchange the classes of each div’s inner account: It’s like this: <div class="col-md-4 pl-2"> Change to: <div class="col-md-3 pl-2"> Read more on the bootstrap Grid System…
-
0
votes1
answer34
viewsA: Function Result in an Object Array?
It would create an array to add the words to the array and then just take the desired position: <?php $url= 'https://www.telelistas.net/ac/acrelandia'; function palavras_chave($pc){ $array =…
-
0
votes1
answer1074
viewsQ: Pick up child object - firebase
I have a firebase bank in this structure: { "-L4Wqs3YbAlUgTWElF4Q" : { "receita" : { "-L6m_C46-Mj1py6RtF8H" : { "imagem" : "default", "ingrediente" : [ "ovo", "leite" ], "nome" : "um nome",…
-
0
votes3
answers2992
viewsA: How to convert HTML to JSON?
If I understand you want to turn JSON into HTML... You can create your json: var json = [ {UF: 'RS', link: 'http://google.com'}, {UF: 'SP', link: 'http://google.com'}, //... ] Make a loop to read:…
-
1
votes3
answers262
viewsA: Browse array to find a particular index
var b = false for(let i = 0; i<users.length; i++) { if (ipt.nome == users[i].nome && ipt.senha == users[i].senha) { e.preventDefault(); console.log('Bem vindo ' + form.nome.value + " !");…
-
0
votes2
answers277
viewsA: Function that by clicking open a respective <ul> on another page
A very simple way, you will need to change only one thing in the menu links: <a class="btn-8" href="categories.html?cat=Mobiles"> <!-- Passar via get a categoria --> <div…
-
1
votes2
answers59
viewsA: Help with logic - PHP
You can do the query directly in the sql query, for example in Mysql: SELECT SEC_TO_TIME(SUM(TIME_TO_SEC(tempo) * $qtd)) FROM protocolo TIME_TO_SEC() - Converts time into seconds (tempo * $qtd) -…
phpanswered Costamilam 9,556 -
0
votes2
answers97
viewsA: How to put keywords on my site pages
If you want something simple you can use the tag <abbr> of HTML: Site <abbr title="pt.stackoverflow.com">StackOverflow</abbr> em portugês…
-
7
votes1
answer200
viewsA: Show text with first uppercase letter
yes, use ucfirst ucfirst("eu sou bom"); //Retorna "Eu sou bom"
phpanswered Costamilam 9,556 -
0
votes2
answers65
viewsA: How to send back my array’s response to views? and appear within td
I believe, at least for now, that your code does not need a model, just a view and a controller, but leaving it in the same pattern as you are doing: View: <?php session_start(); //função…
phpanswered Costamilam 9,556 -
14
votes2
answers314
viewsQ: =, BINARY, LIKE, LIKE BINARY, REGEXP, SQL binary grouping
Reformulation of the question based on @Gabrielhenrique’s answer and research: What is binary grouping in a string column in the table? BINARY serves to make a case-sensitive search and LIKE…
-
1
votes2
answers367
viewsQ: Mysqli vs PDO - query/function execution
Looking at questions here from the stack and the php.net website, I saw that query/function executions in Mysqli use if() to check whether it was executed or not, and the PDO uses try { ... }…
-
1
votes1
answer844
viewsA: Create HTML list with SQL query return
Before the forech you open the list <ul> or <ol>, inside puts the data between <li> </li> and then closes </ul> or </ol>: echo "<ul>"; while($aux =…
-
2
votes1
answer371
viewsQ: Delete firebase web folder
How to delete a folder from Storage? To delete a file I use: firebase.storage().ref('pasta/arquivo.png').delete() But it doesn’t work if I use it directly in the folder:…
-
1
votes1
answer2021
viewsQ: ref() or Child() when reading firebase web data
What’s the difference between ref() and child() firebase? When should I use one or the other? Is there any difference in performance?
-
0
votes3
answers1577
viewsA: Percentage mask
<input> "range" type elements lets the user specify a numeric value that must not be less than a given value, and not more than a specified maximum value. The precise value, however, is not…
-
1
votes1
answer501
viewsQ: Sort firebase list
Currently I use this function to read data from firebase database: function ler() { database.ref(referencia_database).orderByChild('nome').once('value').then(function(snapshot) {…
-
1
votes3
answers260
viewsA: Block link in . php
does a validation with regex on front-end and/or back-end, making it impossible to send files with extension other than the desired In PHP: preg_match("[a-zA-Z0-9-_\.]+\.(jpg|gif|png)",…
phpanswered Costamilam 9,556 -
0
votes2
answers94
viewsA: How to create an element with child without adding it?
Example with innerHTML: document.getElementById ('exemplo').innerHTML = '<div> 1 <div> 2 </div> </div>' The element exemplo may be a div, careful, if using a container with…
-
2
votes3
answers384
viewsA: Does anyone know how I do this effect on the background of this div?
An example: <div style='background-image: url("image.jpeg"); background-size: 100% auto;'> <div style='background-image: url("point.jpg"); width: 100%; height: 700px;'> </div>…
cssanswered Costamilam 9,556 -
2
votes2
answers767
viewsA: Product registration - create features
I made a simple code to start but you must improve for your application Reorder: function reordenar() { var num = document.getElementsByClassName('contador') for(var i = 0; i < num.length; i++) {…
-
0
votes1
answer114
viewsA: Use of Side Navbar Materialize CSS
One way to do it is by creating multiple files and linking them with the tag <a href='caminho/da_pagina/produtos.html'>Produtos</a>, if I am not mistaken the menu items are in tags…
-
1
votes1
answer92
viewsA: Class diagram x Database
With the classes below I have a Demand that has a requester and an analyst, right next to each of the classes I must have a list of demands? I don’t quite understand this question, but if you want…
-
-1
votes3
answers532
viewsA: Changing site color via GET parameter
Just to complement the answer: PHP has other variables with similar uses, the $_GET passes data through the url, the $_POST passes this "hidden" data (both are deleted when switching pages, for…
-
1
votes1
answer46
viewsA: How to automatically generate and redirect the link in the header
It is possible yes, To configure the page url see these links: How to Make URL Friendly or How do I make url friendly in PHP For testing you can pick up the current url with $_SERVER["REQUEST_URI"]…