Posts by marcusagm • 4,828 points
86 posts
-
1
votes2
answers1795
viewsA: How to create a PDF from Dictionary data extracted from a . txt (Python) file
As suggested by @cryptotux, use the library reportlab. To generate the PDF through a dictionary, where each word will be on a line, do: import os from reportlab.pdfgen import canvas from…
-
0
votes1
answer68
viewsA: Concept of a Saas virtual store system
Using the variable $_SERVER['SERVER_NAME'] will get the domain that was accessed. So, with this information you can get the desired company. Here comes the way your application has been developed.…
-
1
votes3
answers923
viewsA: window.showModalDialog does not work on Google Chrome, is there anything equivalent?
The function seems to have been discontinued, and its problem is quite common to happen in legacy applications. What you can do is check the existence of the function, and if it doesn’t exist,…
-
1
votes2
answers2192
viewsA: How to send multiple values with inputs of the same name
To send multiple fields with the same name, just treat them as an array. To do this, place brackets in front of the name. Behold while ($linha = mysqli_fetch_array($notas, MYSQLI_ASSOC)) { $cpfAluno…
-
1
votes3
answers808
viewsA: How to calculate the difference between the server time and the user’s computer?
You can simplify the problem by working with UTC hours. so you can work the dates via Timezone in both PHP and javascript. PHP In PHP use the function gmdate it will always return the date and time…
-
1
votes1
answer1039
viewsA: Pass variable value through a button
Just pass the variable via URL. <a href="vol.php?email=' . $resultado["email"] . '" class="btn btn-custom btn-roxo ">Acessar</a> To get the variable in the script that will process the…
-
2
votes1
answer515
viewsA: How to make a schedule counting from time to time?
You have two possibilities using linux CRON or crafting a script that runs indefinitely. Run script forever To run the script indefinitely just do set_time_limit(0); while (true) { // código a ser…
-
1
votes1
answer47
viewsA: Sticky menu with problem updating page in Firefox
It will probably occur in other browsers as well, as the class is only added when the action of scroll. To resolve this issue you need to perform the check also when the document finishes loading.…
-
4
votes1
answer838
viewsA: Uncaught Referenceerror: $ is not defined in shopping cart
The use of jQuery is wrong. The function $(Document). ready() has a similar signature. // 1º Forma completa $( document ).ready(function() { $(document).on('keydown', '#busca', function(){…
-
0
votes2
answers98
viewsA: Instantiation problem using Pdo/Fatal error: Uncaught Error: Class
Apparently there is no user class defined in your code. It would be interesting to separate the second snippet of your question and create a specific file for the user class that will have the…
-
4
votes1
answer55
views -
3
votes3
answers1808
views -
3
votes1
answer1996
viewsA: Advantages and disadvantages of using PHP Video Stream?
HTTP Header Range (Download split files) PHP allows not only for videos, but for any kind of download, to put together a script for managing the delivery of parts of files. This is how sites like…
-
4
votes1
answer5161
viewsA: How do I send push/php notifications with the site window closed?
To implement this feature use the Html5 Push API. Stay tuned for browser compatibility. Another caution you should take is that PHP is not a good language to implement daemons, that is, implement…
-
0
votes4
answers6560
viewsA: Telephone and CPF masks in Textfield
It is possible to use optional characters $('.tel_celular').mask('(99) 9999-9999?9').focusout(function() { var phone, element; element = $(this); element.unmask(); phone =…
-
7
votes1
answer776
views -
3
votes4
answers4172
views -
3
votes3
answers1172
viewsA: How to make change in order sequence with SQL statement
Table change You are experiencing a difficulty because you do not have a unique identifier for each record. I recommend adding the field in your table id and mark as auto increment so you will have…
-
2
votes3
answers8386
viewsA: How to create a task scheduler without using cron and without using wordpress
Installation automation A solution to the problem of manual installation would be to automate via shell script. Script would import the database, set up the STMP automatically, create the required…
-
1
votes3
answers8386
viewsA: How to create a task scheduler without using cron and without using wordpress
Create a table in the database (I am using Mysql). Logging tasks in the database can easily enable and disable a task, as well as change it when necessary. CREATE TABLE `cron_task` ( `id` int(11)…
-
1
votes1
answer2189
viewsA: Using while inside while in PHP
Your loops are correct. Perhaps the error occurs because you are using do { // Código } while( ... ); In place of while( ... ) { // Código } For using do .. while, the loop is executed at least…
-
2
votes1
answer157
viewsA: How to create a page that has different information for each type of user?
<?php if ($_SESSION['tipo_usuario'] == 1) { ?> <p>informação do usurário tipo 1</p> <?php } else { ?> <p>exibe informações do usuário 2</p> <?php } ?> Or if…
-
1
votes1
answer209
viewsA: Listing data by date
The following way tries to minimize the number of queries to the database, leaving only two queries and for the rest PHP is responsible. The logic is nothing more than to get the dates that will be…
-
13
votes4
answers12892
viewsA: How to convert float number to spellnumber in PHP?
Native function does not exist, but there goes a recursive implementation. <?php function convert_number_to_words($number) { $hyphen = '-'; $conjunction = ' e '; $separator = ', '; $negative =…
-
2
votes1
answer148
views -
7
votes1
answer9796
viewsA: What is the shortcut in Workbench to run the whole script
By menu Query -> Execute (All or Selection) Shortcut in windows ctrl + shift + enter Shortcut on your Mac command +shift + enter…
mysql-workbenchanswered marcusagm 4,828 -
0
votes1
answer283
viewsA: Sublime text with Exit code 1. How to resolve
Try the following to save your C file with the right encoding, the sublime assumes that the encoding of the files in the output is UTF-8. File->Save with encoding->UTF-8 It is possible to edit…
-
9
votes1
answer8949
viewsA: List states, cities and neighborhoods on registration form
Normalization First I recommend normalizing your ad table, if you already have tables to store states, cities and neighborhoods, you only need to have the neighborhood code in the ads table, because…
-
2
votes1
answer9292
viewsA: How to set up and check Mysql to improve performance
There is a Perl script called Mysqltuner which allows a quick and easy view about the state of Mysql Server. The script is recommended to assist in setting up for a performance gain. To get the…
-
1
votes1
answer9292
viewsQ: How to set up and check Mysql to improve performance
How to set up the Mysql server for better performance in relation to memory usage, processing and cache usage where the machine has limited resources? Is there any tool that can help me set the best…
-
6
votes7
answers811
viewsA: How to write variables in PHP?
Without context it is difficult to explain why it stores variables in a single array. Maybe you are already preparing to pass the variables as parameters for PDO execution, as the example below:…
-
5
votes2
answers1951
viewsA: Testing whether a radiobutton input is selected in PHP
To recover the value of this input you need to place this table inside a form tag. <form action="processa-tabela.php" method="post"> <table> <tr> <td>...</td>…
-
2
votes3
answers7154
viewsA: How to hide directory paths in htaccess url?
Unless you specify the path to each file on .htaccess, or create file name patterns such as lib_arquivo.php that will redirect to lib/arquivo.php there is no way to do only with regex.…
-
1
votes1
answer1423
viewsA: display products by listed category of the database with PHP PDO
<p class="titulo-produtos">Produtos..</p> <ul class="menu-produtos"> <?php try { $sqlCategoria = 'SELECT * FROM categorias ORDER BY nome ASC'; …
-
3
votes2
answers2905
viewsA: Phpmailler Error sending email SMTP connect() failed. UOL HOST
Like you’re using the door 587 probably the server should ask for SSL connection. Change the code to: $mail->IsSMTP(); // Define que a mensagem será SMTP $mail->Port = 587 ; $mail->Host =…
-
3
votes2
answers2206
viewsA: Redirect with htaccess keeping the URL
Write your .htaccess thus <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^$ exclusive/index.php [L] RewriteRule…
-
1
votes1
answer130
views -
5
votes3
answers4049
viewsA: How to check if my current time is in an hour interval?
You can work with timestamp $start = strtotime( date('Y-m-d' . '08:25:00') ); $end = strtotime( date('Y-m-d' . '12:25:00') ); $now = time(); if ( $start <= $now && $now <= $end ) {…
-
2
votes1
answer1736
viewsA: Send a message to the specific user in Websocket PHP
Below let’s understand how the operation of a Socket server. php server. $host = '192.168.0.28'; // Host do servidor para conexão $port = '9000'; // Porta do servidor para conexão $null = NULL; //…
-
0
votes3
answers637
viewsA: Deploying queues for Websocket
To create a multi-client socket server, it is necessary to store the client connections Ids in a queue, it can be a simple array where in each received connection is stored the connection array that…
-
1
votes1
answer3382
viewsA: dynamic friendly url
By your code you must be having problems creating routes and passing the parameters via GET. Since you are not using object orientation, things get a little more boring to do, and calling files…
-
2
votes1
answer512
views -
5
votes1
answer336
viewsA: What is the purpose of { } (keys) to be used to delimit PHP code?
According to PHP documentation Any PHP script is built by a series of instructions. A instruction can be an assignment, a function call, a loop, a conditional instruction, or even an instruction…
-
0
votes1
answer49
viewsA: How to do time reading in the database?
Your error is occurring in PHP code, change it as follows: <?php include("config.php"); if (isset($_POST["sendlast"])) { $last = filter_var($_POST["sendlast"], FILTER_SANITIZE_NUMBER_INT,…
-
3
votes3
answers294
viewsA: How to relate category instance to a product instance in PHP
For the product to have several categories if understood right, just do the following: class Produto{ public $nome; public $categoria = array(); public adicionarCategoria(Categoria $Categoria) {…
-
2
votes3
answers253
viewsA: Is it possible to modify a field before performing a search? (PHP MYSQL)
I see three possibilities for your problem. Use the function REPLACE, which would leave the search extremely slow, due to the amount of substitutions you will have to make by registration; Write…
-
1
votes4
answers201
viewsA: Simplify IF instructions in PHP
I believe that the most readable and performative solution to the problem would be to convert the variables into a matrix, and to check whether each combination has only one value. $combinacoes =…
-
0
votes1
answer246
viewsA: Query in SQL, query a limited number of record
In most cases SQL does not have functions for this. if I have been using Mysql it is certain that it is not possible. But to solve your problem it is possible to adopt two approaches. Use two…
-
0
votes2
answers68
viewsQ: Separate access hits by area in Google Analytics
I have an enterprise management system that I am using Google Analytics to track the most accessed areas, but next to this system is the presentation site and some hotsites. As I developed in PHP…
-
1
votes1
answer111
viewsQ: How to minify HTML with PHP without affecting <pre> and <textarea> tags?
When trying to minify an HTML with the function below, I have problems with tags that preserve the spacing shown in the code. The function is as follows: function compressHtml( $buffer ) { if(…