Posts by Valdeir Psr • 10,804 points
433 posts
-
2
votes1
answer874
viewsA: How to enable debug() in PHP?
Since this function is not native to PHP or Xdebug, it will not work. As mentioned above in the question’s comments, this is a Cakephp function, but it is possible to add it to your project. For…
-
2
votes2
answers57
viewsA: Why is my arithmetic mean wrong?
This happens because the window.prompt returns the value in string. Other than PHP, the javascript will not add up the value using only the signal +. In that case, the javascript will just…
javascriptanswered Valdeir Psr 10,804 -
2
votes3
answers760
viewsA: Hide part of string
Use a class css to hide part of the number and with jQuery you remove this class (displaying the full string). $(".telephony a").click(function() {…
-
3
votes4
answers604
viewsA: Return only positive results
Use a conditional before subtracting the values of the variable time1 and time2: se (time1 >= 0) e (time2 >= 0) entao /* Restante do código */ fimse It’s been years since I’ve used the…
-
0
votes1
answer288
viewsA: Load data into a div table within a form
You don’t need to use js to store several equal values and then create the select. You can simply create a select and keep it hidden. Here’s an example of how to do: // Captura o "select" com a…
-
2
votes2
answers45
viewsA: return tinyint as boleano in json Ncode
The error is that basically what you are doing is capturing all the table information tb_alunos > Saving only the data liberadoexercicio in the variable $array > Deleting the first record with…
phpanswered Valdeir Psr 10,804 -
1
votes1
answer319
viewsA: Doubt about autoload php
The ideal is to follow the PHP standards. PSR-0 It was discontinued, but worth reading PSR-4 In use With these recommendations you will learn more about the use of namespace. Basically the namespace…
-
0
votes1
answer569
viewsA: Problems with Javascript API
I just tested and checked several other errors, let’s go by part. Module is not defined This error is because you are loading the script vendor/module.js after the Chord.js, Controls.js, Events.js…
-
0
votes1
answer127
viewsA: Make PDO_SQL extension work in PHP (sql server) help
In the WampServer you must open the file C:\Wamp\bin\php\php<version>\phpForApache.ini, look for ;extension=pdo_sqlsrv and remove the semicolon, if you do not have this line, simply add and…
phpanswered Valdeir Psr 10,804 -
1
votes1
answer965
viewsA: PHP + MYSQL autocomplete - returning ID
To return data from id and nome of the professional, we must inform the query sql these fields. Ex: /* Aqui utilizarei uma lib do Typehead para auxiliar. Essa lib irá nos auxiliar com os requests */…
-
0
votes2
answers188
viewsA: Removal of elements in the DOM with removeChild()
Turns out you’re trying to access the attribute value from a list (li) and that attribute does not exist. Instead of using value, utilize innerHTML function addCity() { var nameCity =…
-
2
votes1
answer98
viewsA: Asynctask - Does not run twice
According to the documentation of Asynctask, there are some rules that need to be followed: Asynctask class must be loaded into the UI. The task instance should be created in the UI.…
-
1
votes1
answer93
viewsA: Jquery modal var
To work with multiple "modals", you need to work with the "ID’s". And in this case work with toggleClass maybe not the best option. $(document).ready(function() { $('.page-wrapper').on('click',…
-
2
votes1
answer101
viewsA: Problem with modal
For your code to work, you must add the library jQuery on your page html before your first <script>. <script…
-
0
votes1
answer51
viewsA: the table does not receive registration
The error is on the line mysql_query($sql,$con); Taking a look at the structure of your table, we can see that the field id_funcionario is the type not null, therefore, you must fill in a number.…
-
1
votes1
answer184
viewsA: Changing field type Mariadb(Mysql)
Use the query ALTER TABLE. ALTER TABLE incremento CHANGE `id_faz` `id_faz` INT AUTO_INCREMENT;…
-
1
votes1
answer454
viewsA: How to cancel an INSERT event on Trigger?
It is not possible to stop one INSERT for TRIGGER (or at least not without using a gambiarra). You have two options in this case: Check the quantity before entering the record and display a message…
-
1
votes2
answers1261
viewsA: Javascript only works after two clicks
It turns out the way you’re doing, you’re calling the function resp and then assigning a new action to the button btn-menu You don’t need to add the event onclick again. <a href="#"…
javascriptanswered Valdeir Psr 10,804 -
0
votes2
answers1923
viewsA: How to turn canvas image into PNG?
You can do all this with the js. Just create a anchor dynamic. Example: html2canvas(document.querySelector("#tiraafotomisera")).then(canvas => { var anchor = document.createElement("a");…
canvasanswered Valdeir Psr 10,804 -
11
votes3
answers738
viewsA: How to move Int to Base64 in PHP?
The best way to do this in PHP is by using pack. This function will allow you to have a big-endian byte order implementation. <?php $byte_array = pack('J*', 5460109885665973483); var_export(…
-
1
votes1
answer456
viewsA: Open the same modal with several buttons
The problem is that you are using the ID, which must be unique in several. The correct is: HTML: <?php while ($row = $QUESTResult->fetch_array()) { ?> <a id="test<?php echo $row["id"]…
-
4
votes1
answer45
viewsA: Equivalent of . test() (js) in php
Yes. No PHP you can use the preg_match if ( preg_match("/[\d]+/", $value) ) { /* Code Here */ }…
-
0
votes1
answer1294
viewsA: Generate png download from a div?
Yes, it is possible to generate a png from a div and it is also possible to download an image from your div. If your image is in PNG, just use this form (with pure js). // Botãod de Download var btn…
-
2
votes1
answer448
viewsA: Catchable fatal error: Object of class mysqli could not be converted to string
The object $this->conexao must be the type string to work. The correct thing would be to remove it. The correct (in your code) is probably: mysqli_query($this->conexao, sprintf("INSERT INTO…
phpanswered Valdeir Psr 10,804 -
1
votes1
answer104
viewsA: Mysql query in phpMyAdmin
The mistake is in SELECT id,nome FROM 'materias_superior' WHERE id = 1. When you pass the table or field name, use the grave accent " ` ", thus. SELECT id, nome FROM `materias_superior` WHERE id = 1…
-
0
votes1
answer858
viewsA: How to remove numbers from a string?
To capture only the first 4 digits, just use the function replace var valor = String(ValorTotal).replace("." , ""); valor.substr(0, 4); // Captura do primeiro ao quarto dígito.…
-
2
votes4
answers6985
viewsA: How to underline html / css
To remove an underscore, you can change the value of text-decoration (Code below). To add a color, simply change the value of text-decoration-color. Ex: .esp .facebook a { text-decoration-color:…
-
2
votes1
answer70
viewsA: Limit output that has the same ID
I did some tests and some research, I found a solution to this case. /* Nessa primeira parte nós definimos algumas variáveis */ SET @num := 0, @type := 'estado'; SELECT `estado`, hotel FROM ( SELECT…
-
2
votes2
answers563
viewsA: Div shows no picture
Your CSS code is incorrect. Is missing the px or % when defining height and width. The background-image accepts only the image, to use the image and the optionno-repeat, use only background The…
-
1
votes2
answers578
viewsA: Receive POST ID and play to Location via GET
To capture the last added ID, just run the sql query. mysql_query("SELECT LAST_INSERT_ID()"); Or you can use the function mysql_insert_id…
-
1
votes1
answer86
viewsA: How do I load while the page is loading with Semantic UI?
Just add the loading with html <style> * { padding:0; margin:0; } html, body, #loader { height: 100%; width: 100%; } #loader { background: #000…
-
1
votes2
answers960
viewsA: Echo colored in php
You can do a function that generates these colored letters. function geraLetrasColorida($palavra) { // Separa as letras $letras = str_split($palavra); // Percorre todas as letras foreach($letras as…
-
3
votes1
answer37
viewsA: Can you select several tables with the beginning of the same name?
Yes, it is possible to filter the table name by passing a certain term. To do this just use the query SHOW TABLES SHOW TABLES LIKE "suporte_78%"…
-
6
votes1
answer138
viewsA: Change "copy" to "copied" in Clipboard.js after click
To update the button, add a callback at the event success. This event will return (as parameter) the element clicked and with access to this element, you can change the value of the property…
-
1
votes3
answers31
viewsA: Does not work SQL
It is necessary to inform the field where the Where must filter. SELECT * FROM participacao WHERE manutencao = 'Equipamento' AND NOME-DO-CAMPO = 'Material de saude' ORDER BY Id DESC If you want…
-
0
votes4
answers747
viewsA: Regex in Python to find several possible names
Following the text published in the question comment: http://m.uploadedit.com/bbtc/1513873742547.txt You can capture this information with regex \b(.+)(?:\n.*)(?:relatora?|desembargadora?|ju[íi]za?)…
-
3
votes1
answer253
viewsA: Increase payments to installments with Jquery?
You can sum up days using the function getDate and setDate of the object Date Thus. var date = new Date(); // Captura a data de hoje: 22/12/2017 var dayOfMonth = date.getDate() //Captura o dia do…
jqueryanswered Valdeir Psr 10,804 -
1
votes1
answer31
viewsA: Change integer value to string or insert mask
Use the toLocaleString, this way you will work better with formatting numbers or coins. function numerosHome(id, inicialValor, valorFinal){ var inicial = inicialValor; var location =…
-
0
votes2
answers1345
viewsA: Save textarea content as text file
First let’s go to mistakes. The first is in the way you are opening the file. According to the documentation from PHP, the way w is only used for file creation. In your case the correct way is to+.…
-
0
votes1
answer102
viewsA: How to avoid installing Apache when installing php7.1 on Ubuntu 16.04?
The php7.1, by default, already comes with apache, you can remove it, but... You can use the apt-get remove apache2* && apt-get purge apache2 You can "build" the PHP manually. But you can…
-
1
votes1
answer48
viewsA: How to access an array within an object?
To access an array within an object, just pass the index through keys. $user->{'0'}->id $user->{'0'}->name $user->{'0'}->sex $user->{'0'}->car…
phpanswered Valdeir Psr 10,804 -
3
votes1
answer809
viewsA: Customize . tofixed to use comma as decimal separator
If you are working with coins, the recommendation is to use toLocaleString. var numero = 250.8 * 2; console.log(parseFloat(numero.toFixed(2)).toLocaleString('pt-BR', { currency: 'BRL',…
javascriptanswered Valdeir Psr 10,804 -
1
votes1
answer157
viewsA: Display Dialog (Materialize) with ajax without clicking the button
Just replace alert("Fechado com sucesso!"); for Materialize.toast('Fechado com sucesso!', 4000) <link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css"…
-
0
votes2
answers343
viewsA: Adding strings from a regular expression
Unable to perform with options Regex. Regular expressions serve basically to identify and return certain values. In your case, besides the Regex, is to use two functions of PHP: preg_match_all to…
-
5
votes1
answer861
viewsA: How to block downloads from my server
TL;DR Yes, it is possible. Manners One of the most efficient ways is to use DRM for the protection of videos. As there is no precise description of what is the DRM (Digital Rights Management), some…
phpanswered Valdeir Psr 10,804 -
0
votes2
answers52
viewsA: With extract list from a link
You can use a Regular Expression to capture all this data. This way you can easily filter the content. The simplest way to capture these values with the PHP, is to use the function preg_match_all.…
-
0
votes1
answer221
viewsA: How to send image to route from Laravel with AJAX
You can convert canvas to image and then send via "raw" To convert the content to image, we need to access the function toDataUrl canvas. It will serve to transform the object into a Base64. By…
-
2
votes1
answer479
viewsA: Accountant with Ajax
Just create a global variable and add or compare the value. Actually this is not done with Ajax but with Javascript. The Ajax is just a jQuery function that serves to make requests. Jquery:…
-
2
votes1
answer2591
viewsA: What is the ABSPATH method for?
ABSPATH is not a method. It is actually a constant created in PHP code. Some systems/frameworks use these constants as this helps maintenance, readability of code and etc. Imagine the following…
phpanswered Valdeir Psr 10,804 -
6
votes1
answer234
viewsA: Email as Primary key
No problem using email as PRIMARY KEY, however, it is not recommended. There is a way to avoid that a data is recorded more than once, for this you can inform, during the creation of the table, the…
databaseanswered Valdeir Psr 10,804