Posts by Luiz Fernando • 649 points
38 posts
-
0
votes2
answers299
viewsA: Codeigniter - How to make a select in the database query?
Hello all right? For your example specified above, you can do: $this->db->select('*'); $this->db->join('medico','id_medico=idMedico','inner');…
-
0
votes0
answers74
viewsQ: Problem with checkbox with dependencies and other checkbox
Good afternoon to you all. I have a system in which I am setting the permissions in which the profile can have access on a page via checkbox for each module of the system. I have a page with form in…
-
1
votes1
answer14035
viewsA: How to update the php version in xampp?
I use Wamp but Xamp has the same behavior and I have a vhost for each system I use in my C: DEV directory. In case I do not move and it is interesting you leave your XAMP with the default setting…
-
1
votes2
answers836
viewsA: Return data from a Json where there is a specific key in a PHP variable
Working only with the direct JSON and PHP object, without converting it to array, an example of how you can do it is: (explain in the code the step-by-step) <?php // String JSON $str_json =…
-
0
votes1
answer572
viewsA: Required in select does not work if you change the order
The attribute Selected in a option of a select works in a way that is the default option, which is already selected. Value is the content that is sent. Soon if you want the word 'Select' to be sent…
-
0
votes1
answer199
viewsA: Recover JSON data via POST
Well the function json_decode if you want to transform from json to array the syntax is: $encode = json_decode($datas, TRUE); From the moment you transform into an array you have to capture working…
-
0
votes3
answers869
viewsA: Questions to send data via POST
PHP is correct to say that there is no index 'username'. Because when working with forms and php, when using both the HTTP request method: $_POST like the: $_GET, the information is sent by the name…
-
-1
votes2
answers1507
viewsA: How to update a password in MYSQL and encrypt it
You can use md5 to enter the encrypted password. An example of use would be: I have the following table and want to update user password 1 to an encrypted password: I use the command md5('password')…
-
1
votes1
answer370
viewsA: take the status of pg_query and pass to php variable
The command pg_last_error gets the last error message string of a connection, so it is necessary to pass the connection string. echo pg_last_error($conn); For example the code below: <?php //…
-
3
votes1
answer335
viewsA: GROUP BY does not work in Mysql 5.7
This is because Mysql 5.7 is now standardized as ONLY_FULL_GROUP_BY enabled. To disable it: 1) Go to the bin folder where you have your Mysql installation (in the case of my computer is: C: WAMP…
-
5
votes1
answer71
viewsA: Counting the quantity of products
Let’s take an example: I have the following product table called tb_products: create table tb_produtos( id int(14) not null auto_increment, marca varchar(100), tipo varchar(100), qtd int not null,…
sqlanswered Luiz Fernando 649 -
1
votes2
answers129
viewsA: How to delete specific contents of a . txt with php
I made a code using an ajax function passing the information in json format to the action_plugins.php file, which receives the input data and saves in file called 'plugin.txt'. I also checked if the…
phpanswered Luiz Fernando 649 -
8
votes2
answers5439
viewsA: How to use PHP on the command line?
Hello all right? We can use php with command line. Example: let’s use php in the command line to execute a script that displays the "Hello terminal" message; In case you create the php file, for…
-
2
votes2
answers1036
viewsA: UPDATE in two PHP tables
When you want to perform more than one query or several, and that this data is related or one operation depends on the other, sql transactions are recommended. An example where I need to update my…
-
0
votes2
answers96
viewsA: PHP does not display Json
This is because you are using jQuery Slim version. Replace with the jQuery Uncompressed version below, which will work(download and paste into your js folder which is your context, download site is…
-
1
votes2
answers66
viewsA: Show only larger records two days before today
Example: I want to get the id and date of the tickets that are dated today and two days ago, so: select id, data from tb_boleto where data BETWEEN curdate() AND DATE_SUB(curdate(), INTERVAL 2 DAY);…
-
0
votes1
answer363
viewsA: SELECT INNER JOIN using PHP foreach in Datatable
This is because you are bringing the type name when you declare in select: type_ps.type $query .= "SELECT users.*, tipo_ps.tipo, categorias.categoria FROM users INNER JOIN tipo_ps ON users.tipo_fk =…
-
1
votes2
answers511
viewsA: Bring only the first occurrence of a regex
Maybe we don’t need the regex: Assuming we have the following table and want to get the first date of the description field: Running the command below: select left(descricao , 10) from tb_dados; We…
-
1
votes3
answers229
viewsA: Why is an anonymous function seen as an object in PHP?
Because there is no data type "Function". The function gettype() php returns the type of the variable. The return data types of the gettype function are: "Boolean" "integer" "double" (for historical…
-
0
votes1
answer96
viewsA: Problem in the Foreach array
I simulated how the array might look and below there is an explanatory code. Run var_dump to see the output. It looks like what you’re looking for. It is necessary to validate that the ID is not…
-
0
votes2
answers525
viewsA: str_replace with php explodes
First: it is interesting to remove line breaks (as it is replaced by two consecutive points we will use this in our favor). Second: let’s use the explode to separate our array where the line breaks…
phpanswered Luiz Fernando 649 -
0
votes2
answers59
viewsA: Call an arraylist from another method, to print in the different method
The error occurs here: In the Agenda class, you are passing the parameter $add for an array type variable called $bancoDeDados and not to a property called bancoDeDados. Your code simply works by…
phpanswered Luiz Fernando 649 -
0
votes2
answers189
viewsA: Add array at the end of another array in a foreach
I put the &$celula so that it actually changes the array by passing it by reference and prints the result below, which is what you want: <?php $celulas = array( 0 => array("idCelula" =>…
-
0
votes2
answers401
viewsA: Problem with json slim framework
To transform from a json object to an array in Php you must use the syntax: echo json_decode($dados, TRUE); . You have to pass the TRUE parameter to transform it into array. To print the information…
-
0
votes1
answer126
viewsA: failed url rewrite slim iis 10
The only problem is that you forgot to put the bar before your hello method. You put :$app->get('hello/{name}' instead of $app->get('/hello/{name}' Your code should look like this: <?php…
-
0
votes1
answer909
viewsA: Find parameter with Slim Framework 3
I think the problem with your code is to call the variable that receives the Slim App() object $this. That is, from what I saw you did: $this = new \Slim\App(); when you should have called the $app…
-
1
votes1
answer145
viewsA: How to Add Style Sheet to a Slim Framework Project
1) Create the 'Assets' folder within your public directory and within it the 'css', 'js' and 'images' folders'. 2) You must indicate no. htaccess the following settings so that from your main…
-
2
votes1
answer317
viewsA: JSON formatting created in PHP
Your array will be: array ( 'success' => true, 'message' => '', 'data' => array ( 'id' => 'lojas_monitoradas', 'name' => 'lojas monitoradas', 'data' => array ( 'total' => 1, ),…
-
-2
votes2
answers92
viewsA: Check a file extension
function run() { var receita = document.getElementById("receita").value; var extensoes, ext, valido; extensoes = new Array('.txt', '.pdf', '.doc', '.png', '.jpeg', '.jpg'); ext =…
javascriptanswered Luiz Fernando 649 -
0
votes3
answers1448
viewsA: Error - fa icons (Fontawesome.css)
Guy think your problem is being in your files. I put the Font Awesome link via Cdn and it worked normal. Check the folder paths and if your files are ok. <!DOCTYPE html> <html>…
-
1
votes2
answers210
viewsA: Logic for ABC curve
Your select would look like this: SELECT COUNT(v.id) as qtd_vendas, v.client_id as id_cliente, c.nome as cliente FROM tb_vendas v LEFT JOIN tb_cliente c ON c.id = v.client_id GROUP BY id_cliente,…
-
0
votes4
answers771
viewsA: Align button to the right side of select
You can do this without touching the CSS: <div class="form-group"> <label class="col-md-4 control-label" for="Selecione">SERVIÇOS :</label> <div class="col-md-4"> <select…
bootstrap-3answered Luiz Fernando 649 -
4
votes2
answers294
viewsA: Concatenate variable with array in PHP
To add to the array you enter the key and simply assign its variable: $dias['dia'] = $nome; But if you already have a value inside and just want to concatenate with the existing content you use:…
-
4
votes1
answer3676
viewsA: What are software components?
The "official" definition given at a conference on Components in 1996 is: "A component is a unit of composition with contractually specified interfaces and with explicit context dependencies only A…
-
0
votes4
answers401
viewsA: Skipping route due to poorly formatted parameter is a syntax error?
The error 404 is an HTTP response code indicating that the client was able to communicate with the server, but the server could not find what was requested. In your case it was possible to…
-
0
votes2
answers4189
viewsA: Required for Checkbox / HTML5
Java Script is an option to do this validation in the Front-end, if you are using some programming language as Php could also do the validation by the Back-end. Only with HTML the only option would…
-
-1
votes2
answers634
viewsA: How can I check if the browser supports HTML 5?
The good thing is always to look at the documentation about the resource and its support by the browsers. Here is a list of the main features of HTML5 and the level of support by browsers:…
-
0
votes4
answers836
viewsA: Quote at the beginning and end of each number
Another way of doing: $seq = "123,456,789"; $explode_seq = explode(',', $seq); $n = array(); foreach ($explode_seq as $num){ $n[] = "'" . $num . "'"; } $result = implode(" , ", $n); echo $result;…
phpanswered Luiz Fernando 649