Posts by rbz • 9,949 points
356 posts
-
5
votes3
answers555
viewsQ: Create an "opacity" on top of a <tr>
I have a dynamically generated table: I would like to create a class in CSS to make a "layer" on top, with transparency. Example: If I use the background-color, it will only change the background,…
-
0
votes0
answers41
viewsQ: "@" before method
I’m running some tests with the function ldap_bind() and came across something I don’t know and didn’t find in research. Considering the line of the script: $bind = ldap_bind($ldap_conn,…
-
0
votes1
answer105
viewsQ: ldap_search com ldap_get_entries returns no value
I’m making authentication via LDAP: $server = '192.168.0.1'; $domain = '@meudom'; $port = 389; $auth_user = 'usuario1'; $auth_pass = '123'; $ldap_connection = ldap_connect($server, $port) or…
-
3
votes2
answers268
viewsQ: Open and close the code or use variable?
Two scripts with the same result: Example 1: <?php ...códigos PHP acima... $tabela = '<table>'; $tabela .= '<tr>'; $tabela .= '<th> Valor1 </th>'; $tabela .= '<th>…
-
1
votes1
answer1536
viewsQ: Generate page break report in print
I have a form that generates a list I need to print. That list, sometimes I will print only a few pages, so on each page, I need to have some data: page number balance from the previous page caption…
-
0
votes1
answer70
viewsQ: Search in Array with conditions
I have a Array of records: Array ( [0] => Array ( [HANDLE] => 1 [Z_GRUPO] => [EMPRESA] => 1 [FILIAL] => 1 [DATAINICIO] => 2018-01-01 [CONSUMO] => 2 [VEICULO] => 82 ) [1]…
-
0
votes1
answer30
viewsQ: Parent::method does not return connection
I have a class Conn connecting to an SQL Server: class Conn { protected $con; protected $a = 'aaa'; function __construct() { $this -> conecta(); } private function conecta(){ $serverName =…
-
2
votes1
answer782
viewsQ: Identify screen size to load content asynchronously
I have a script that does reload every 10 seconds, loading a page into a div: <script type="text/javascript"> var tempo = 10000; function listar() { $.ajax({ url:"lista.php", success: function…
-
1
votes2
answers997
viewsA: Upper and lower case in PHP
The easiest way would be in the INSERT treat all the strings you use for comparisons (in PHP, because in the database, depending on which one you use is not case sensitive). Complementing what Lucas…
-
6
votes4
answers653
viewsQ: Cross values in array
I have a value X and I have a array with various values. I would like to search all the same values and smaller, which would enter into a combination that their sum would give the value X. Example:…
-
2
votes1
answer40
viewsA: Looking for similar items when using an intermediation table?
It works that way, but as soon as I can see others. The way I see it, there’s no other way subquery. So I trained and separated all animes and their genres, and the generos, I played for a subquery…
-
1
votes1
answer42
viewsA: Get to display last URL characters
Edit As seen, your result is not as written in the question as you are doing wrong reading the file. Try it this way: $arq = file("url.txt"); foreach($arq as $linha){ echo buscaFinal($linha); echo…
-
2
votes1
answer857
viewsQ: Run minimized or hidden PHP script by Task Scheduler
I have a scheduled task in windows (working perfectly), where you run a PHP script: Scheduler: email php.: <?php require_once 'classes/core.class.php'; set_time_limit(120); $tempo1 =…
-
1
votes1
answer564
viewsA: ERROR 1215 (HY000): Cannot add Foreign key Constraint
Reason for the error: You need to "index" the item_pedido_id table item_pedido. Why? Foreign key requires reference to a primary and/or unique key. Resolution: Place item_pedido_id table item_pedido…
-
2
votes1
answer554
viewsQ: Image compression without changing content format (png, jpeg, gif, webp)
The difference from this question to duplicates: keep the content format (png, jpeg, gif, webp), in order not to harm images with layers, transparency, etc. The others do not have. I have a file…
-
1
votes2
answers797
viewsQ: Aid balloon/information
I would like to know, basically, how do these balloons appear when we hover above the icon: It can appear at any position of the correct screen!? But how to align it with the icon?…
-
2
votes1
answer60
viewsA: Search unica mysql
EDIT #1 As noted by the questioner, MariaDB ignores the ORDER BY in subquery: Why is ORDER BY in a FROM Subquery Ignored? The solution is to use a LIMIT to search all records: SELECT SUM(entrada) as…
-
3
votes2
answers529
viewsA: Send email using Phpmailer
Motive: Translated error: "Unable to access file" file.tar.gz in /var/tmp/, i.e., it did not find the file and/or the folder. Resolution: As you probably picked up from an example, these lines show…
-
0
votes0
answers29
viewsQ: Dynamic space reserve
In other issues in Sopt, a question arose of those that generate doubts. About the type VARCHAR, that has dynamic space allocation as stored data, I ask: It’s different to use VARCHAR of VARCHAR(2)?…
-
2
votes3
answers750
viewsQ: Space occupied between different types of integers
By the table of official Mysql documentation, and a question here at Sopt, I had a question. Considering the table: Type Storage(Bytes) MinimumValueSigned MinimumValueUnsigned MaximumValueSigned…
-
2
votes4
answers11349
viewsA: What is the difference between SMALLINT(3) and INT(3)
The difference is the range of values they accept (according to the table), i.e.: Signed SMALLINT: -32768 to 32767 INT: -2147483648 to 2147483647 Unsigned SMALLINT: 0 to 65535 INT: 0 to 4294967295…
-
0
votes1
answer594
viewsA: Email phpmailer
Ideally you would use "hidden copy". You wouldn’t have to create another object to send a "copy" to you. Using "for/cc/cco" in Phpmailer: To add recipients ("for"), use $mail->AddAddress():…
-
2
votes2
answers122
viewsA: Query of similar records
I don’t understand why either, as Woss said. But in any case, an example of how to do: (there may be other ways, even simpler) Considering Table = tab PK = id Column 1 = C1 Column2 = C2 select *…
-
1
votes1
answer589
viewsA: Export Sqlite to Mysql
Yes, you have the option to export: Server -> Data export You can create a file dump or script, with the structure of the tables, with the data or not, etc:…
-
1
votes1
answer577
viewsA: I’m trying to create a Mysql Trigger but is giving syntax error
As quoted in the comments by Ricardo, its structure is incorrect in the scenario MySql. Example of the structure: DELIMITER $ CREATE TRIGGER Tgr_ItensVenda_Insert AFTER INSERT ON ItensVenda FOR EACH…
-
1
votes1
answer207
viewsQ: Query to count table dependencies
Let’s assume I have a database with only 50 tables. In the structure, I have several connections, several foreign keys. There is a way, so to make a query that brings the amount of dependencies of…
-
0
votes0
answers31
viewsQ: Look for value in array with multilevel index or not
I have 2 arrays: One with the index cod multilevel and other non: $array1 = array( 0 => array("item" => 101010, "cod" => 70), 1 => array("item" => 102010, "cod" => 80), 2 =>…
-
1
votes1
answer443
viewsQ: Read contents of a folder and process files asynchronously
I have a briefcase with several XML. I would like a script to read these files, and process each of them. How do I make to read the contents of the folder and "pull the files", since are different…
-
2
votes2
answers17697
viewsQ: Set width of <tr> or <td> in HTML5
I need to set the width of a column in a table, but the width (inline) HTML5 is not supported, according to documentation: HTML Tag In this case, it cannot be done inline ? What options ? As in…
-
33
votes2
answers564
viewsQ: Performance in PHP: consider or not?
I see great connoisseurs here of Sopt, saying the phrase: "Want performance, forget PHP" For example, questions about PHP: "How can I improve the performance of that?" Of course we know that…
-
4
votes3
answers90
viewsA: How to "break" the PHP variable and bring separate results
Follow a way of doing: // Seus dados $tipo='a,,c,d'; $metragem='15,18,,44'; // Transformando em array $tipo = explode(",",$tipo); $metragem = explode(",",$metragem); // Unindo todos arrays em 1 $arr…
-
6
votes1
answer264
viewsQ: What is the processing order of a PHP script?
Example scenario: echo hello(); echo '<br>'; echo 'Hello ' . world('World'); function hello() { return 'World'; } function world($v) { return $v; } Exit: World Hello World Like the PHP process…
-
1
votes2
answers1469
viewsA: Convert from decimal or integer to php hours
Simply: function convertHoras($horasInteiras) { // Define o formato de saida $formato = '%02d:%02d'; // Converte para minutos $minutos = $horasInteiras * 60; // Converte para o formato hora $horas =…
-
5
votes1
answer94
viewsQ: Why does the print_r print before the echo?
I got the following array: $array = array(10,20,30); print_r($array); Exit: Array ( [0] => 10 [1] => 20 [2] => 30 ) If I print with echo before the print_r: echo 'primeiro: ';…
-
6
votes3
answers1243
viewsQ: Merge all values at the same array level, at the same level
I got the following array: Array ( [A] => Array ( [0] => 10 [1] => 20 [2] => 30 ) [B] => Array ( [0] => 100 [1] => 200 [2] => 300 ) [C] => Array ( [0] => 1000 [1] =>…
-
0
votes2
answers2939
viewsA: How to change from mysql_real_escape_string to mysqli_real_escape_string();?
The mysql_real_escape_string no longer works in PHP 7. You need to go back to PHP 5 and also pass your "connection" as parameter. Example with mysql_real_escape_string: $link =…
-
0
votes1
answer27
viewsA: Compares sqlsrv_query with text
You can do the if within the while: // Exibe o resultado while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) { if ($row['Login'] == "renato") echo 'Bem-vindo'.'<br>'; else echo…
-
0
votes1
answer179
viewsA: Example login with Oracle php
Error In view of you are using the function incorrectly on "oci_num_rows <=0". Look at this example from official documentation of oci_num_rows: Example <?php $conn = oci_connect("hr",…
-
0
votes2
answers123
viewsA: Andorid - Open Activity only once
You can create in Main, a flag on SharedPreferences, and check it every time the app starts. If the flag has false, opens the activity desired and already changes to true. I didn’t find here a…
-
2
votes2
answers79
viewsQ: Colour tone of the record, for quantity
I have a table with various records, and these have a field "date". I generate a list of these records, I make the difference of days comparing to "date" with the "current date". Example: $dias =…
-
3
votes1
answer149
viewsA: Know the direction between points by coordinate latitude and longitude with php
[Update 2] Final script (can still be improved): // Detalhes $n_pontoA = "Iranduba"; // Nome do ponto A $n_pontoB = "Manaus"; // Nome do ponto B // Coordenadas $c1_barco = '-3.3105, -60.1694'; //…
-
3
votes2
answers59
views -
1
votes1
answer79
viewsA: Add size column (Mb) in php script that lists directory files
Example in your code: // Loop que gera registros foreach (new DirectoryIterator($path) as $fileInfo) { if($fileInfo->isDot()) continue; // Pega a quantidade de bytes do arquivo, setando a…
-
1
votes3
answers13294
viewsQ: Perform a function after full page loading
I have a page that loads several tables, then organizes them in tabs. You would be able to perform a function when all page loading is finished ?
-
3
votes1
answer1554
viewsA: List directory files in a table using php
You will create only one table and a line of titles, so you can’t repeat this, just like you can’t repeat the table (</table>). Example: <?php $path = "arquivos/"; // Título echo…
-
0
votes1
answer321
views -
0
votes2
answers97
viewsA: String to int conversion
You can use 2 forms as needed: Integer.parseInt(valorString): returns a Integer. or Integer.valueOf(valorString): returns a primitive (int) As prmottajr said, you may have trouble with a String…
-
3
votes1
answer275
viewsQ: Separate line contents in the Bufferedreader loop
I have files txt with approximately 5,000 items, and these do not have a pattern, for example: 10 20 30 40 50 60 70 80 90 100 I need to import this into the SQLite, where each value is 1 record.…
-
1
votes1
answer112
viewsQ: Replace in empty line
I have a variable with the following content: 10 20 30 40 50 60 70 80 90 100 There are spaces (can be 2 or more in a row) and line breaks (also several in the sequence), and I want to replace to…
-
2
votes1
answer96
viewsA: how to do a query by ordering an ascending and a descending column
The way you’re ordering: ORDER BY qty_pass DESC, material_name ASC You’re ordering first by qty_pass, thus, if it does not have equal values in the qty_pass, then will never order the material_name.…