Posts by WebCraft • 485 points
40 posts
-
0
votes1
answer24
viewsA: Slimframeworrk only accesses by duplicating bars in the URL
I ended up finding the solution to the problem. Apparently Slim requires the server file to have the name of: index.php I changed it to index.php and ran the command: php -S 0.0.0.0:3131 -t src…
-
0
votes1
answer24
viewsQ: Slimframeworrk only accesses by duplicating bars in the URL
I am using Slimframework and I have the following code: <?php use Psr\Http\Message\ServerRequestInterface as Request; use Psr\Http\Message\ResponseInterface as Response; use…
-
0
votes1
answer42
viewsQ: When and where to instantiate a class?
When performing the project, it is recommended to instantiate a Class in the file where it is implemented (Ex.: "classname.Class.php"), causing it to be instantiated even without being used in the…
-
0
votes2
answers331
viewsA: php - Cast double with number_format
After several tests on other Linux distributions and even using XAMPP for Windows, we could see that it is not a programming bug, logic error or something like that, but a version-specific BUG PHP…
-
1
votes2
answers331
viewsQ: php - Cast double with number_format
When executing: $number = 50/3; var_dump(number_format($number, 2, '.', '')); is returned string(5) "16.67" however I need this value to be given in decimal type, so I run the cast to (double).…
-
0
votes1
answer151
viewsA: Failed to get about: googleapi: Error 401: Invalid Credentials, authError
I solved the problem. Basically, the software stores a Google Drive Authentication key in the . json file in the directory /home/.gdrive/ /home/.gdrive/file_cache.json /home/.gdrive/token_v2.json…
-
0
votes1
answer151
viewsQ: Failed to get about: googleapi: Error 401: Invalid Credentials, authError
I’m using a generic Linux application from Google Drive, which aims to Upload local folders to Google Drive via Shell Script. However, when trying to run command on the Debian terminal: ./gdrive…
-
1
votes2
answers469
viewsA: How to access content from a json file?
The file is returning a JSON file that needs to be interpreted. import json j = json.loads('{"id_str": "934805933334712320", "media_url": "http://pbs.twimg.com/media/DPkZCyZX0AAB6QP.jpg"}') print…
-
0
votes0
answers131
viewsQ: Two-dimensional Matrix in C
I have a record of products in C. Products can have up to 30 characters (columns), but can be infinite in quantity (rows). In the variable declaration, I used: char products[][30]; but when…
-
-2
votes1
answer39
views -
3
votes1
answer629
viewsQ: Param Bind with Array - PHP and Mysqli
I have the code: <?php $clientes = implode(', ', $clientes); $busca = $mysqli->prepare("SELECT nome FROM clientes WHERE id IN (?)"); $busca->bind_param("s", $clientes);…
-
0
votes1
answer523
viewsQ: Organize HTML table data - CSS - SQL
I have the following code <table border="1"> <?php $sql = $mysql->prepare("SELECT id FROM usuarios WHERE status = 0"); $sql->execute(); $sql->bind_result($id);…
-
1
votes2
answers245
viewsQ: Add a month to jQuery
I have the following date: 2017-12-22 (22 December 2017); You would need an increment that adds up to 1 month to the current one, returning: 2018-01-22 (22 January 2018). How do I do it in jQuery?…
-
2
votes2
answers320
views -
0
votes3
answers80
views -
1
votes3
answers80
viewsQ: Display only one message at the end of an operation within a WHILE
I have a situation. I do a search in a table and from the returned data, insert in a new table and update the current one. Ex: $busca = $link->prepare("SELECT valor FROM tabela1 WHERE funcionario…
-
0
votes3
answers151
viewsQ: Display success message once in for loop
I have the code: for ($i=0; $i < count($descricao); $i++) { $id_caixa_hoje = $linha['id_caixa_hoje']; $valor_formatado[$i] = abs($valor[$i]); $inserir = mysql_query("INSERT INTO…
-
2
votes0
answers95
viewsQ: How to perform selects through Workbench Diagrams?
I am migrating to Mysql Workbench and need to perform a relationship between tables SELECT... INNER JOIN... LEFT JOIN..., but I wanted to accomplish through the diagram of Diagrams. How can I…
-
0
votes3
answers51
viewsA: Interpret data from an external file to use in Autocomplete
I was able to find a solution: var dados = [ source ]; var availableTags = JSON.parse(dados); It worked perfectly, returning me this result: It would be safe to use it this way?…
-
0
votes3
answers51
viewsQ: Interpret data from an external file to use in Autocomplete
I have the following file: index php. <script type="text/javascript"> function montaAutocomplete(source) { $( function() { var availableTags = [ source ]; $( "#autocomplete" ).autocomplete({…
-
1
votes3
answers77
viewsQ: How do I link three tables?
I have three tables. Note that if I perform an INNER JOIN in the three tables, I would return only product 1 (Router), which is present in the three tables. However, I would need him to return all…
-
-3
votes2
answers1787
viewsA: How to convert a string into an object in Javascript?
I managed to solve with a little research, rs. If someone is in this situation, use as follows: var dados = eval(source); The function Eval() evaluates or executes an argument. If the argument is an…
-
1
votes2
answers1787
viewsQ: How to convert a string into an object in Javascript?
I have this code: <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta name="robots" content="noindex, nofollow"> <meta name="googlebot"…
-
1
votes1
answer446
viewsQ: How to query via AJAX and store the data in a javascript variable?
I have this code <script> $(window).load(function(){ var source = [{ label: "Tom Smith", value: "1234" }, { label: "Tommy Smith", value: "12321" }]; $("#descricao").autocomplete({ source:…
-
0
votes1
answer199
viewsQ: Autocomplete insert the value into two different inputs?
I have this code <script type="text/javascript" src="js/jquery-1.4.2.js"></script> <script type='text/javascript' src="js/jquery.autocomplete.js"></script> <link…
-
2
votes1
answer518
viewsQ: SELECT ... WHERE name LIKE bind_param
I have the following code: <?php $link = new mysqli("localhost", "root", "minhasenha", "meu_db"); $produto = $_GET['q']; $produto = '%'.$produto.'%'; $busca_produtos = $link->prepare("SELECT…
-
0
votes0
answers39
viewsQ: Is it possible to perform an external UPLOAD with ajax?
I have this code: function uploadFile(x){ //DEFINIÇÃO E RECEPÇÃO DAS VARIAVEIS PRA ENVIAR COM O AJAX var file = document.getElementById("id_arq_documento_" + x ).files[0]; var id =…
-
0
votes1
answer400
viewsQ: if (isset($_POST['send'])) does not work with Ajax
I am sending information to another page via Ajax: <script type="text/javascript"> //Função para enviar as informações para o arquivos processa.php //via Ajax function envia(x){…
-
3
votes1
answer95
viewsQ: SELECT Union ALL Disregard Arguments
I have This query that sums two results in different tables. SELECT sum(g) saldo_anterior from ( SELECT SUM(valor_pg) g FROM ctrl_deposito WHERE MONTH(data_pg) < 11 and YEAR(data_pg) <= 2016…
-
0
votes2
answers510
viewsQ: How to select data from the previous month and year?
I’m trying to search from dates in Mysql. I need to obtain the total sum of a value where the year and month are smaller than those reported in the variable: SELECT SUM(valor_pag) FROM controle…
-
-1
votes1
answer64
viewsQ: How to perform a bind_param() with SELECT UNION ALL
I have that code. <?php $link = new mysqli("localhost","root", "SENHAAAA", "BANCO"); $sql_saldo_total = $link->prepare( "SELECT sum(g) saldo_total FROM ( SELECT SUM(valor_pg) g FROM tabela1…
-
1
votes2
answers1582
viewsQ: I need to connect to an SSH FTP server in PHP
I have this code: <?php $ftp_server="MEUHOST.COM"; $conn_id = ftp_connect($ftp_server, 2222) or die("Couldn't connect to $ftp_server"); if (!ftp_connect($ftp_server)) echo "not connected"; else…
-
1
votes0
answers1426
viewsQ: How to create an api?
I scoured the internet for sample API tutorials in PHP, query and insert in Mysql. Do you have any examples I can use as a test?
-
0
votes0
answers91
viewsQ: Error with Curlfile
Hello, everybody. I have the following code: <form action="" method="POST" enctype="multipart/form-data"> <input type="file" name="image"> <input type="submit" value="POST">…
-
4
votes1
answer2094
viewsQ: Send files via FTP with PHP
I have the following PHP code to upload PHP files and send to an external server via FTP. However, it returns me the following error when I upload: Warning: ftp_put(): Illegal PORT command. in…
-
3
votes0
answers121
viewsQ: Upload several files, though, each at a time?
I’m looking for some code that uploads several files to the PHP server, but in the style of Google Drive: One file at a time, but in the same form. Type the image below:…
-
2
votes2
answers4050
viewsA: Send PHP notifications
Hi. I have a code here. If you don’t run it here, save it to your server and run it directly. Then you just use your creativity to edit.. Can handle with Mysql <html> <head>…
-
2
votes2
answers984
viewsA: How to update data from a table only if the new values are different from the current ones?
You can make a SELECT before. Ex.: $verifica = mysql_query("SELECT cod_oferta, titulo FROM cadastra_oferta WHERE cod_oferta = '$cod_oferta' and titulo = '$titulo'") or die(mysql_error());…
-
1
votes3
answers669
viewsA: Field with Cedilla in Mysql
Guys. Thanks for all your help, but I solved my problem. Just add the line mysql_set_charset('utf8'); in the related.php file to work. Recalling that also the addition of the crase before…
-
0
votes3
answers669
viewsQ: Field with Cedilla in Mysql
I have a field in my database table Mysql with the name 'description', with the special accents. My problem is this: When I make a INSERT INTO using directly the phpMyAdmin, it normally inserts the…