Posts by Claytinho • 331 points
22 posts
-
0
votes0
answers35
viewsQ: MYSQL change float field to decimal
My queries using PHP PDO in Mysql FLOAT fields do not find results with cents. It seems to me that PHP PDO always sends the value of the variable as a string. Even with the variable typed in float.…
-
1
votes1
answer171
views -
1
votes2
answers109
viewsA: How to hide short words with PHP
<?php $titulo = 'Locacao de onibus'; $palavras = explode(' ', $titulo); $ocultar = ['de', 'para', 'com']; $resultado = array_diff($palavras, $ocultar); $resultado = implode(' ', $resultado);…
-
1
votes1
answer171
views -
1
votes0
answers98
views -
1
votes0
answers48
viewsQ: Low memory after mysqldump
I’ve been observing that always after running mysqldump, the server’s free memory gets very low and is not released right away. The command I’m using is mysqldump --default-character-set=latin1…
-
0
votes1
answer175
viewsA: PHP + Mongo: Cannot create SSL client
In php.ini I noticed that SSL was disabled libmongoc SSL disabled To enable you need to install packages before installing mongodb yum install openssl-devel pkgconfig…
-
0
votes1
answer175
viewsQ: PHP + Mongo: Cannot create SSL client
How do I connect to a Mongo+SRV DB $manager = new MongoDB\Driver\Manager('mongodb+srv://username:[email protected]'); Error: Fatal error: Uncaught Exception 'Mongodb Driver…
-
0
votes2
answers376
viewsA: Query does not return fetch_array
$sql->execute(array($emp, $exercicio, $ans)); $dt = $sql->fetchAll(PDO::FETCH_ASSOC);
-
-1
votes1
answer51
viewsA: Take a value from another field other than id
Whereas you are using PDO. First let’s "prepare()" the query, replacing the user-sent values with ? (this also solves the SQL Injection problem). In "execute()" you send an array with the value of…
-
1
votes1
answer76
viewsA: Error while searching in form with Friendly URL
Just as you have "Rewriterule" rules for other urls, create one (first of all) just for research. RewriteRule ^es/pesquisa\/?$ pesquisa.php [L] Then remember to update the action to the friendly…
-
1
votes2
answers1706
viewsA: Show result on same page with php
In your index add Calc.php <?php include "header.php"; ?> <?php include "calc.php"; ?> <?php include "footer.php"; ?> In Calc.php check whether a post has been sent. <?php if…
-
1
votes2
answers530
viewsQ: Atom not saved in correct encoding
When saving a file by Atom, it always records the accents in UTF-8. Even though the file being identified as ISO-8859-1 (there at the bottom). So I did the following test at the terminal: Before…
-
1
votes1
answer1006
viewsQ: git does not eat charset changes
Hello, I created several files in ISO-8859-1 but now I am converting them to UTF-8. However, git does not identify this encoding change and even if I try to force a commit (adding any text), the…
-
0
votes1
answer88
viewsA: How to send information via local POST to external server?
To post to an external server, use Curl: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://www.exemplo.com.br'); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('login' =>…
-
0
votes1
answer55
viewsA: How do I filter my data?
I’m reusing your code ok. <input type="text" name="marca" value=""> <input type="submit"> <?php $sql = "SELECT * FROM veiculo"; $condicoes = null; if ($_REQUEST['marca']) { // alerta…
-
4
votes2
answers3638
viewsA: How to turn this Curl / PUT command into php?
$url = 'https://api.mercadolibre.com/items/ITEM_ID?access_token=YOUR_ACCESS_TOKEN'; $cabecalho = array('Content-Type: application/json', 'Accept: application/json'); $campos =…
-
0
votes1
answer154
viewsA: Convert htacces to Nginx
See if it helps: # non-www to www server { listen 80; listen 443 ssl; server_name seudominio.com.br; return 301 $server_protocol://www.$server_name$request_uri; } server { listen 80; listen 443 ssl;…
-
0
votes0
answers673
views -
0
votes1
answer371
viewsA: fpdf with cakephp
1 - Create a layout for example "pdf.ctp" in /views/layoyts <?php header("Content-type: application/pdf"); echo $content_for_layout; ?> 2 - In the controller, use the layout above. 3 - In the…
-
2
votes2
answers306
viewsA: How to set flash in CAKEPHP view?
I don’t know which version of Cakephp you’re using, but in 1.2 just use the $Session helper and call the flash() method without "echo" <html> <body> <?php if ($session ->…
-
2
votes1
answer2571
viewsQ: How to securely encrypt and decrypt PHP data?
I need to write confidential data in the database, but which can be read later (decrypt).