Posts by David Alves • 2,470 points
112 posts
- 
		0 votes1 answer24 viewsA: Take a variable from within a functionAt the end of your function, after the end of while, write the line: return $inforGeral; That way, in the place where you call the function, you can receive your variable that way: $inforGeral =… 
- 
		1 votes2 answers40 viewsA: geolocation want to take data from java script and pass to a HiddenTo accomplish the desired, you must put 2 Hidden inputs in your html and then add the code below within the function showPosition in that way: <p id="demo">Clique no botão para receber sua… phpanswered David Alves 2,470
- 
		1 votes2 answers44 viewsA: Mysql table return with PHP foreachThe function you are using $res->fetch(PDO::FETCH_ASSOC); only returns the next line of the query, so that you return all the rows in the desired way you should create a while calling the… 
- 
		0 votes1 answer54 viewsA: "Fatal error: Uncaught Error:" in databaseYour error is precisely in line 9 of the code presented, because in it you call the function redirecionarCadastro("consultar-hospital.php",$res); that is not defined at any other point in the code.… 
- 
		1 votes2 answers42 viewsA: Error including js in viewTransform the file funcoes_ameai.php in an archive funcoes_ameai.js and call you in the view as follows: <script src="/Includes/funcoes_ameai.js"></script> The difference between the… 
- 
		0 votes1 answer73 viewsA: ZF3 error 404 for a specific module nameI found that in the file config/modules.config.php, the order of modules in the array of namespaces of the project interferes in some way in the ZF3 in a way that did not interfere with ZF2. I… 
- 
		0 votes1 answer115 viewsA: How to make a beginTransaction in the Zend framework?It is possible to use transaction manager in Zend. For this, do it this way: // Chamar adaptador que obterá gerenciador de transações $db_adapter =… 
- 
		0 votes1 answer73 viewsQ: ZF3 error 404 for a specific module nameI have a route on my website which is linked to a module called Cart, but although everything seems to be according to the tutorial and documentation of zend, this route is not found and always from… 
- 
		0 votes0 answers31 viewsQ: Doubt about RSS feedI’m developing a page of feed for a blog PHP pure and came to me some doubts that I could not find the answers. Feed items should be displayed for how long? For example, should a post created last… 
- 
		-1 votes1 answer60 viewsQ: Count specific character amount in a rangeI have a data range similar to that: I need to count how many V’s and D’s are in between. I’ve tried using SUMIF and COUNTIF Can someone help me?… 
- 
		0 votes2 answers588 viewsA: How to put td as link.Do so: $table .= '<td><a href="caminho-da-imagem-na-pasta">'.$r['IMAGEM'].'</a></td>'; //É SÓ ESSA AQUI 
- 
		1 votes2 answers934 viewsA: Identify if mouse scroll is rolling up or downIt is possible to do this in javascript, with the script below you can identify in console.log: <script> var body = document.getElementsByTagName("body")[0]; if (body.addEventListener) { //… javascriptanswered David Alves 2,470
- 
		2 votes1 answer44 viewsA: What is the OPTION=3 parameter for in the Database connections?The Option= receives a value that identifies the sum of flags that will specify how your ODBC should work, the default value is 0. It is possible to check an old version of the documentation on… 
- 
		7 votes4 answers2971 viewsA: Identify how many days the month has (28, 29, 30, 31)There is a native php function for this, it is cal_days_in_month. This function will return the number of days in a year Month to the specified Calendar. int cal_days_in_month ( int $calendar , int… phpanswered David Alves 2,470
- 
		2 votes1 answer1184 viewsQ: Get Deadline with Postal Web ServiceI am trying to get the delivery time dynamically using the Webservice Post, for this I am using this documentation. If you enter the their test page, it is possible to enter the PAC service, for… 
- 
		5 votes1 answer39 viewsA: Compare variable more than once, without repeating itIt is possible to do what you want using the function in_array Thus getting PHP5.4 versions+ $var = 5; if ($var == 1) echo 'A'; else if (in_array($var, [2,6])) echo 'B'; else if (in_array($var,… phpanswered David Alves 2,470
- 
		0 votes1 answer69 viewsQ: Purpose of a foreign key nameI am creating tables for a system I am developing and when entering the part of adding foreign key through the interface of PostgreSQL 9.3.17 I noticed you have the field nome to identify this key,… 
- 
		2 votes3 answers179 viewsA: How to remove character from a String and turn it into integer value with PHP?You can simply remove the comma and the R$, this way: $sua_variavel = str_replace ( ',' , '' , $variave_inicial ); $sua_variavel = str_replace ( 'R$' , '' , $sua_variavel ); In the first line will… phpanswered David Alves 2,470
- 
		0 votes2 answers49 viewsA: I’m having trouble with the last oneYou are making syntax error, missing close a key just before the second else, thus: if(is_numeric($id) && $id >=1){ $stmt = $obj_mysqli->prepare("UPDATE 'clientes' SET 'nome'=$nome,… phpanswered David Alves 2,470
- 
		1 votes1 answer32 viewsA: How to generate sequential variables (e.g.: D1, D2, D3) and then merge everything into a single PHP variableYou can solve your problem by creating the $mtotal and $dtotal within your own foreach, so: $n = 0; $mtotal = ''; // inicializa a variável mtotal foreach($unidades as $unidade){ $n++ echo "… 
- 
		1 votes2 answers12546 viewsA: How do I add more elements to an array in phpIn php you can add elements to a array in many ways, they are: Given your array $erro: Adding element at a specific array position: $erro[5] = $elemento; Adding element at the last position of the… 
- 
		2 votes2 answers71 viewsA: Is it possible to manipulate the numbers of a randint?To do what you want, you could use random.sample, for example: random.sample([350, 400, 450, 500], 1) Where the first parameter is the possible values and the second parameter how many values you… python-3.xanswered David Alves 2,470
- 
		1 votes1 answer97 viewsQ: SQL Alphabetical sorting with html codeI have a table that contains the field titulo. I have a query and want to sort alphabetically by it, however, some fields are with HTML code, I will give examples: Goat Slaughter and Meat Processing… 
- 
		3 votes1 answer68 viewsA: Change javascript/php function from form to divFor this, you need to change basically 3 lines. The first is the line document.clock.face.value = To be amended to: document.getElementById("clock").innerHTML = Then change the lines in the HTML… 
- 
		3 votes2 answers1049 viewsA: How to query MYSQL and PHP using an array as a WHERE pro conditionMake your query like this: $query=("SELECT name FROM users WHERE email IN (".$array_emails.")"); Where the variable $array_emails should actually be a string with all comma separated emails,… 
- 
		2 votes3 answers74 viewsA: Just clear the field I wantIt’s pretty simple, if you’re using jQuery, just use this code: $("input[name='nome-do-input']").val(''); Or, if there are inputs with the name you want in places other than the form you want to… jqueryanswered David Alves 2,470
- 
		0 votes2 answers645 viewsA: What is the <output> tag for?The element output, read as output in the Portuguese language, is generally used to represent the result of a calculation. Example of use:… 
- 
		1 votes1 answer35 viewsA: Move data from a formTo do what you want, is exactly what I said in the comments, but I’ll explain better: Create a field status, for example, in your database for your patients. When you enter a new patient into the… phpanswered David Alves 2,470
- 
		-2 votes2 answers904 viewsA: How to remove CSV file lines using PHP?It is possible to do this in PHP although it is not a single function as you asked: // Leia o arquivo $arquivo = fopen('seu_arquivo.csv', 'r'); // Pega todas as linhas do arquivo while (($linha =… 
- 
		3 votes1 answer322 viewsA: Remove html tag but keep <br> JavascriptIf your code already removes all html tags currently, you can, before passing your function, replace all the <br> by a string specific, such as for example ~br~ and after going through its… 
- 
		1 votes1 answer30 viewsA: Dynamically build page with PHPPut these commands before the require_once and see if any errors will appear. error_reporting(E_ALL); ini_set('display_errors', 1); I believe your require_once is failing, but you are not set to… phpanswered David Alves 2,470
- 
		4 votes1 answer197 viewsA: What does the -n command in git meanThe subcommand -n in the git log is the reduced form for number and will display the output with a defined number of commits given after the -n Source: https://git-scm.com/docs/git-log… gitanswered David Alves 2,470
- 
		3 votes2 answers167 viewsA: Problem with mysql_query, the data does not fall in the SQL database.You are using the command mysql_query wrongly. According to the PHP documentation, the function mysql_query is defined by: mysql_query ( string $query [, resource $link_identifier ] ) Where the… 
- 
		0 votes2 answers190 viewsA: check difference between values with phpTwo things are wrong or incomplete in your code. The first is that $ is missing before the quantity variable in two lines. And the second is that this way does not guarantee that the variable… 
- 
		0 votes2 answers80 viewsA: Insert line in MYSQL without leaving the page (using PHP)If you have the possibility to use jQuery, it is possible to do what you want by enabling an action at the click of the download by sending a POST to another page PHP, where there you do the INSERT,… 
- 
		5 votes3 answers456 viewsA: Check that the value of $_GET is an Integer numberYou can use the function is_numeric of PHP that checks if a variable is a number, even if it comes as a string. But it has to be noted that it will check from Hexadecimal to Real and binary numbers… phpanswered David Alves 2,470
- 
		4 votes1 answer3357 viewsA: What is the number of decimal places of type NUMBER(12,2)?The guy NUMBER in Oracle has the following syntax: NUMBER[(accuracy [, scale])] Where precision defines how many "characters" your number will have and scale defines how many decimal places. For… 
- 
		0 votes2 answers767 viewsA: Doubt with pdf generation and sending via mpdfYou can do it this way: Save to server in a temporary folder Send attached by email with your own email service Finally, delete the file from the temporary folder on the server… phpanswered David Alves 2,470
- 
		0 votes3 answers82 viewsA: Common conveter array in associative arrayYou couldn’t because you have one array within your first array in which you rotate the foreach, this will work: <?php $array_errado = array( 0 => array( 'name' => 'email', 'value' =>… phpanswered David Alves 2,470
- 
		1 votes1 answer556 viewsA: Soapclient error with php 7.1 on shared serverYour problem is probably happening coming from the file php.ini On the error server, uncomment the line: ;extension=php_openssl.dll Removing the ;… 
- 
		1 votes3 answers1428 viewsA: (SQL) In parentheses in the WHERE clauseThe parentheses causes Postgresql to treat all grouped conditions as one thing, for example, in its first query, as the OR are outside the parentheses, so if any cst_icms is equal to '030', '060',… 
- 
		4 votes3 answers68 viewsA: Problem in select orderThe following query will work: SELECT data, uniques, pageviews FROM ( SELECT data FROM tb_visitas ORDER BY data DESC LIMIT 7 ) aux ORDER BY aux.data ASC LIMIT 7 
- 
		0 votes0 answers74 viewsQ: Function Focus Jquery not working mobileI have the following function in my code .js: element = $('.bloco-pesquisa').find('#inp-pesquisa'); element.focus(function(){ alert("focus!"); if (!load_autocomplete){… 
- 
		-1 votes2 answers201 viewsA: Convert from varchar to float when the string is empty and/or blankMake a UPDATE on your table UPDATE sua_tabela SET campo = '0%' WHERE campo = '' OR campo IS NULL Then you will have all the fields in the required pattern for your cast and then throw the field to… 
- 
		2 votes2 answers79 viewsA: How to place notifications in Title?You can do this using a function on javascript: function changeTitle() { var titulo = document.title; var numero = 5; // Número de notificações a ser exibidas var novoTitulo = '(' + numero + ') ' +… 
- 
		-1 votes3 answers282 viewsA: How to use a text selector in html?I don’t know if it’s exactly what you want, but you can let the textarea customized using tinyMCE. The Tinymce is a textarea with editable freatures. You can leave only bold and italic, until the… 
- 
		1 votes2 answers326 viewsA: Error when trying to connect to SQL Server with Codeigniter and PHP 7I’m sorry to inform you, but the function mssql_connect() was removed from the PHP 7.0.0 how it is possible to check in the manual here. Now you should use alternative functions like… 
- 
		2 votes2 answers79 viewsA: Colour tone of the record, for quantityWhoa, I think I can shed some light on your problem. In the example below, I had a uniform gradient printed, but you can do your grading in any way necessary. You only need to keep in mind that you… phpanswered David Alves 2,470
- 
		1 votes1 answer106 viewsA: Select php and connection to the Beginner databaseThe error is on this line: // Executa uma consulta $sql = "SELECT 'id', 'nome' FROM 'Instituicoes' LIMIT 5"; The right thing would be // Executa uma consulta $sql = "SELECT 'id', 'nome' FROM… 
- 
		1 votes1 answer103 viewsA: $_Session [ ' ' ] = array ( )Why the variable has two keys together as in your example $_SESSION['itens'][$id] means that the variable $_SESSION is an array and one of the fields of that array is itens. The variable then… phpanswered David Alves 2,470