Posts by arllondias • 2,492 points
145 posts
-
1
votes2
answers330
viewsA: PHP (Between + Convert Date)
You can convert the date before moving to the query. for example: function convertDatetoSQL($date) { $date = explode('/', $date); return $date[1] . '/' . $date[0] . '/'. $date[2]; } $var_dtfim =…
-
5
votes2
answers2304
viewsA: onclick() in elements generated through ajax?
What you can is assign to document an event click in its class, since the elements are being generated after the DOM has already been loaded, so it will not take the event of the click, do as…
-
1
votes1
answer948
viewsA: How to control routes using Arable middleware?
You can reach your middleware if the user is logged in: /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function…
-
0
votes3
answers924
viewsA: Can you start a Select (SQL) in the middle of the data table?
When the procedure is something more complex, we can work with procedure so you don’t have to keep creating variáveis globais and end up not returning the expected result, so we will have a complete…
-
0
votes1
answer55
viewsA: Summation in SQL
What you need is to make a data curve with the table itens_pedido using JOIN in case I used the INNER JOIN to pick up only products that have orders. But then you can research better and see what…
-
1
votes1
answer24
viewsA: Validate class that executes an sql query
in his DAO you can add a return of the method being it true or false: public function insert(){ $this->conn->beginTransaction(); try { $sql = "QUERY DO INSERT AQUI ......."; $stmt =…
phpanswered arllondias 2,492 -
0
votes1
answer169
viewsA: Sort by day of the week and time
If always the days come back with 3 characters you can use SUBSTRING() SELECT id,dia FROM minhatabela ORDER BY ( FIELD(SUBSTRING(dia,1,3), 'DOM', 'SEG', 'TER', 'QUA', 'QUI', 'SEX', 'SAB') ,…
sqlanswered arllondias 2,492 -
1
votes3
answers392
viewsA: How do I find the first Tuesday of a month?! (SQL)
Try using Oracle date functions for example DAYNAME() if you compare DAYNAME([sua_data]) = 'TUESDAY' will return only Tuesday. Then limit using LIMIT 1
-
0
votes5
answers335
viewsA: How to know the dynamically created textbox id?
You can go through the inputs of your application and pick up the ID’s through the method attr(). staying that way: <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>…
javascriptanswered arllondias 2,492 -
0
votes1
answer799
viewsA: Return database data in <label> with Javascript
you are only returning a success message, what you have to do is return the updated object: php: if ($resultado == true){ $sucess_message="Cadastro atualizado com sucesso!"; echo json_encode([…
-
2
votes1
answer350
viewsA: Indentation after Focus in input with jQuery
From what I understand you can use the scroolBy function and move a few pixels above, as it is only going up to the input focus: window.scrollBy(0, -10); The First parameter moves the horizontal…
jqueryanswered arllondias 2,492 -
2
votes1
answer499
viewsA: Create Procedure in phpmyadmin
You have several syntax errors in this process, follow the correct code: Some were missing ; DROP PROCEDURE IF EXISTS SEND_ITEMS; DELIMITER | CREATE PROCEDURE SEND_ITEMS( IN i_item_id int(11), IN…
-
0
votes1
answer292
viewsA: Item composition from the same SQL table
I had to do something similar, I did it like this: I have a table produto, where all product information is stored, this is just fake information. CREATE TABLE IF NOT EXISTS `produto` ( `produto_id`…
-
0
votes1
answer130
viewsA: Mysql query to display records not linked to a particular company
You have to take everything from the word table and make a left Join with the table of links, then in the Where clause, add the condition where link is null, as you did not find any word there:…
-
2
votes1
answer1060
viewsA: ERROR CODE 1215 - You cannot add foreign key
Apparently it is right its structure, check if the table type is like Innodb same, they can be like Myisam which does not allow creation of FK, follow script that I created from your print and…
-
0
votes2
answers232
viewsA: Pull element that has a specific attribute with javascript
There is however your example is wrong, and you are only taking 1 element with the class coloritem see this example, where I go through all the elements that have this class and check if there is a…
-
3
votes3
answers285
viewsA: Compare and replace Intel array
You can create an array with the days of the week translation, then go through your array translating the key in this way: <?php $arr1 = ['Monday' => 1, 'Tuesday' => 2, 'Wednesday' =>…
-
1
votes3
answers921
viewsA: Simulate click on Jq or JS
You have to create a evento of keydown and fire it at the click of the button, I made an example that returns an alert of the pressed key, already picking from the event keydown: <script…
-
2
votes2
answers868
viewsA: When trying to define column as Unique, error is generated by talking 767 bytes
Summarizing the columns of the type string of Laravel comes with default 255 which causes the size to exceed the maximum for the Internet, go to your migration and change the lenght key field unique…
-
2
votes1
answer81
viewsA: C# - Check if dates are missing in the selected period
In reality you have to use LEFT JOIN, that there you bring the results independent if it has relationship with the tb_routes and the COUNT() will return 0. The INNER JOIN you say you want to take…
-
1
votes1
answer692
viewsA: Change column name "id" of an sql return
You have to describe the columns instead of putting the * and give an alias for them example: SELECT st.id AS [apelido para o id], [demais_campos st], sc.id AS [apelido para o id], [demais_campos…
sqlanswered arllondias 2,492 -
1
votes1
answer146
viewsA: PHP Mailer class does not work
The error information is that it is not finding file in the path you are going through, the file you are making the call from may be in a different hierarchy than you think, so I recommend using the…
-
3
votes1
answer345
viewsA: Select cities with the same name in different states
It would be something like this, first you take only the ones that have more than one recurrence in the table, and then you do a query by name, as you did not know the name of your table just…
-
0
votes1
answer48
viewsA: Count items with a certain extension within a PHP array
There is a function in php that counts count(). Assign the value to a variable for example $qtdReg = count($seuArray); Ref: http://php.net/manual/en/function.count.php <?php $arr = [ […
-
2
votes2
answers105
viewsA: How to define table that will receive the Insert using PHP variable?
Try concatenating the string this way: $sql = " INSERT INTO $nome"."_"."$sobrenome"."_"."$ID_sementes(ano, mes, titulo, descricao) VALUES ('$ano', '$mes', '$titulo', '$descricao') ";…
-
1
votes1
answer26
viewsA: How to get the number of users with less time in each Client?
First you need to do a query grouping the shortest time per Clan, and then a query on the outside to catch who has the shortest time from this Clan, then the query would look like this: SELECT d2.*,…
sqliteanswered arllondias 2,492 -
0
votes3
answers49
viewsA: Remove character to search in database
Create a method that returns to you only digits with Regex for better readability, I say to create a method because you may need elsewhere, add in a class Helper or any other that you store your…
-
0
votes2
answers1448
viewsA: Pass PHP variable in onclick="history.go(-1)"
Instead of doing history.go(-1) create a function where you pass the ID and redirect it to the page you need for example: <script> function redirect(id){ window.location.href =…
-
0
votes1
answer50
viewsA: Triggers - I need help solving the issue below
Come on your Rigger has some errors, first take the dest value in the variable using the LIMIT 1, because if there is more than one record it will try to assign the variable and will give error.…
-
2
votes1
answer6739
viewsA: Create database in mysql
Missing from table in one of your variable assignments, always look for better indenting code for better readability and even find errors, follow the code, just change the tag [sua_tabela] by the…
mysqlanswered arllondias 2,492 -
3
votes1
answer93
viewsA: Limit the amount of fields with Jquery
In the event of the button adicionarCampo count the amount of fields you already have in the DOM: $(".adicionarCampo").click(function () { if ($('.linhas').length < 3) { novoCampo =…
jqueryanswered arllondias 2,492 -
1
votes2
answers58
viewsA: List of Numbers
From what I understand it would be just not call the function if it is the number 2 or 9, getting like this: <meta charset="UTF-8"> <script> function pulaLinha() {…
javascriptanswered arllondias 2,492 -
0
votes1
answer186
viewsA: PHP data collection and inserting mysql data
I believe that in this case, from what I understood it is just order your search to limit it, always returning the last record of the table: $qry = "SELECT * FROM glpi_change_new ORDER BY…
-
0
votes2
answers1993
viewsA: How to get the values inside an array?
is an object within the array, you have to pick with selector, example foreach($array as $item){ $var = $item->nis; }
-
0
votes2
answers54
viewsA: Mysql - Multi Selects in a query
You can use JOIN to make your query simpler: SELECT c.*, COUNT(cn.Clan) AS membros FROM clans c INNER JOIN contas cn ON cn.Clan = c.ID WHERE c.ID = 1 GROUP BY c.ID…
-
0
votes3
answers41
viewsA: Count sql results in table with or without values
Add a COUNT(anuncios.*) AS Qtd in your query and a GROUP BY subcategory.id_subcategory. But observing thus seems to be wrong the JOIN relationship, but as the question is not that the answer above…
-
1
votes1
answer1300
viewsA: Move by Divs via keyboard arrows
You can work with a class for Divs and Keycodes intercepting the event keyup in javascript would look like this, try to understand and adapt your need. <script type="text/javascript"…
-
0
votes3
answers436
viewsA: How to order the query in the same order as an array used in Wherein?
Actually Mysql has an option to SORT the menu you are wanting that is the function FIELD() and in Laravel you can use the orderByRaw, where you can write an SQL statement, I think it’s simpler to do…
-
1
votes1
answer2169
viewsA: Best way to register two foreign keys in a table
You have to create in table 2 foreign keys can be null, Example of table create: CREATE TABLE IF NOT EXISTS forum.pessoa_fisica ( id INT NOT NULL AUTO_INCREMENT, nome VARCHAR(60) NOT NULL, cpf…
-
0
votes4
answers572
viewsA: Generate Excel report by filtering query in Mysql database
You are searching the trip data with a getAll() must be why it is returning all the data, create a method where you search only the filtered data, or pass by parameter to the method geraExcel() the…
phpanswered arllondias 2,492 -
1
votes1
answer3738
viewsA: Delete row from a table with javascript
Work with $(this) to remove the line as follows, let’s pick which button is being triggered the event with this and let’s go up two levels(line level) with Parent(), then yes we will remove only the…
-
1
votes2
answers1201
viewsA: How do I know $_FILES is empty?
Use the isset function of PHP, it checks whether the variable has been set, returning true or false isset($_FILES); Ref: http://php.net/manual/en/function.isset.php…
phpanswered arllondias 2,492 -
2
votes1
answer58
viewsA: Script to remove readonly
I added a class to your button and your password input to avoid conflicts: <?php include_once("../../conn/conexao.php");//faz a conexao com o banco de dados //verifica a página atual caso seja…
-
0
votes1
answer106
viewsA: How to do "When selecting an option in dropdwn, it loads other database data into a Textarea" in php, mysql and Jquery
Put in a date attribute the value you need for each client and in the input change change the value of the text area: <select name="nome_cliente" id="" required> <option value="">Escolha…
-
1
votes1
answer468
viewsA: More than one cursor in the Mysql database
it is possible but you have to work differently the loop, not just checking the done variable, because when the first cursor is executed it will not run the second, then we will work in another way…
-
0
votes3
answers104
viewsA: Doubt with sql Inner Join in multiple tables
if you execute this command: SHOW GLOBAL VARIABLES LIKE '%sql_mode%' will realize that the value has this string ONLY_FULL_GROUP_BY what you can do is copy the value, go in the file my.ini…
mysqlanswered arllondias 2,492 -
1
votes3
answers58
viewsA: SQL Query - Doubt Condition Dates
I believe that’s more or less what you need, follow my test: CREATE TABLE teste(tarId INT, TarVencimento DATE); INSERT INTO teste…
-
0
votes1
answer963
viewsA: Create stored Procedure with Mysql
Good come on, first you will have to create a table of rooms to store this information: CREATE TABLE tb_quarto( cd_quarto INT NOT NULL PRIMARY KEY AUTO_INCREMENT, cd_tipo_quarto INT NOT NULL,…
-
0
votes1
answer33
viewsA: What is wrong with this Mysql CREATE FUNCTION?
Missing set of variables: DROP FUNCTION IF EXISTS SEQ_NEXT_VAL; DELIMITER | CREATE FUNCTION SEQ_NEXT_VAL() RETURNS INT DETERMINISTIC BEGIN DECLARE retorno INT; SELECT MAX(IDE_ERROR) INTO retorno…
mysqlanswered arllondias 2,492 -
1
votes2
answers58
viewsA: Input is not appearing checked
It is as display None and you can switch to an if ternary getting like this: <input type="radio" id="isgift0" name="isgift" value="0" class="arredondado" <?php echo…