Posts by Costamilam • 9,556 points
509 posts
-
1
votes1
answer17
viewsA: Result Grouped by Field and Listing N Records
Run this query using the driver you want (PDO, mysqli_* or mysql_*): SELECT idarea, id, titulo, noticia FROM noticia ORDER BY idarea; Assuming the result of this query is an array and is in the…
-
3
votes2
answers7718
viewsA: Warning: mysqli_num_rows() expects Parameter 1 to be mysqli_result, Boolean Given in
The problem is that your query has some error, so mysqli_query returns false and passing on that value to mysqli_num_rows causes the error Before the if prints on screen the command (echo $sql;) and…
phpanswered Costamilam 9,556 -
1
votes1
answer73
viewsA: Get element by id add two paragraphs
Your code has three problems: To add classes to HTML the attribute is used class, passing a space-separated list, for example, <span class="foo bar baz"></span>…
javascriptanswered Costamilam 9,556 -
1
votes2
answers413
viewsA: what other tag can be used to replace hgoup?
If you just want to group the titles, then use <div>, I don’t know any other tag that has a better semantic value for this case (since hgroup was removed)
html5answered Costamilam 9,556 -
2
votes1
answer28
viewsA: Returns value of an array dynamically
Loop your array by adding a input for each item: <?php $teste = [1,2,3,4]; foreach ($teste as $t) { echo "<input type='text' value='$t'>"; } ?> ideone…
-
1
votes3
answers56
viewsA: Use prepare statement at a constant value?
Assuming you know what it is SQL Injection First you need to understand one thing, Prepared Statement has two features: Escaping values (if well used) Optimize Repeated Searches So you should use it…
-
1
votes2
answers289
viewsA: How to join different foreach results in an array?
You can use the array_map passing by null like callback $unido = array_map( null, $html->find('.Cartaz .filme-single-name text'), $html->find('.Cartaz .filme-img'), $html->find('.Cartaz…
-
7
votes3
answers5803
viewsA: Difference between $.ajax(), $.get() and $.load()?
$.ajax() Serves to make asynchronous requests with any HTTP method, including GET $.get() It’s the same as the previous one, but it’s only good for GET requests The difference between the two above…
-
1
votes1
answer261
viewsA: How to Make Slider Materializecss Resize Height Accordingly to Devices
Media Querys serve to determine a style for a given situation (for example, specific screen size, orientation, among others) For screen size, these breakpoints are usually used: /* Extra small…
-
2
votes1
answer117
viewsA: Nav problem in css
.topBar nav will search for an element <nav> within any other element having the class topBar. What you want is nav.topBar, an element <nav> classy topBar…
-
9
votes4
answers701
viewsQ: How to create and use custom events
Researching I found Event and CustumEvent, both can be used to create events, and to control registrations, removals and emissions of the event should be used EventTarget, but I didn’t understand…
-
0
votes2
answers217
viewsA: Use of chained static functions
To use chained static functions you need to return __CLASS__, for example: class A { static function a1() { echo "A1"; return __CLASS__; } static function a2() { echo "A2"; return __CLASS__; } }…
-
3
votes1
answer102
viewsQ: CSS cross-browser by Javascript
In CSS there are some properties that need a prefix for some browsers, for example: -webkit-transition: all 4s ease; -moz-transition: all 4s ease; -ms-transition: all 4s ease; -o-transition: all 4s…
-
2
votes2
answers43
viewsA: from Javascript to jQuery
A reduced form: function writeTotal(value) { $('#total').html(floatToMoneyText(value)); } That one floatToMoneyText probably could also be converted to jQuery, but would have to know what you do…
-
17
votes1
answer1019
viewsQ: How to send Tokens from server to client?
I am creating an API, I use authentication via Token (JWT), I want this token to be valid for, for example, 10 minutes, and, with each request, return a new Token, so the user will have access while…
-
1
votes1
answer57
viewsQ: Force two elements to always occupy the same space
How to make two elements always occupy the same space, independent of the browser and screen size? I used the transform translateX however, when testing the phone did not work, here I put -18px, in…
cssasked Costamilam 9,556 -
3
votes1
answer32
viewsQ: Capture part of the string between certain repeated characters N times
I have a string that has the format of routes: /foo/ /{bar}/ /foo/{bar} /{foo}/{bar} /{foo}/bar/ Can have numerous values between bars, values between {} are variable I wanted to capture all…
-
1
votes4
answers9163
viewsA: How to refresh the screen in Angular?
Simply put, store in Session/Location Store whether or not it has already been reloaded and use as a condition to reload: ngOnInit() { this.load(); } load() { //Session storage salva os dados como…
angularanswered Costamilam 9,556 -
0
votes0
answers86
viewsQ: What is the difference between self and __CLASS__?
Studying the Singleton design pattern, I was running some tests: class Test { public static $var = "XYZ"; static function class() { return __CLASS__; } static function self() { return self::$var; }…
-
0
votes1
answer109
viewsA: Select Multiple with Material Design Lite
Two very simple examples: Using as a basis the menu component, added the checkbox options <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link…
-
0
votes1
answer39
viewsA: PATH_INFO does not show "extra" bars
I solved the problem using $_SERVER["SCRIPT_NAME"] and $_SERVER["REQUEST_URI"]: //Requisição para example.com/index.php/foo//bar/baz $current_route = str_replace("/", "\/", $_SERVER["SCRIPT_NAME"]);…
-
11
votes3
answers7823
viewsQ: What is the semantic difference between Section and article?
Searching, I found some questions related to HTML5 tags: What is the difference between <div> and <Section>? How to use such semantic tags? HTML5: difference of Section and article MDN…
-
0
votes0
answers63
viewsQ: How to interpolate constants?
Why don’t these interpolations work and how to make them: class Foo { const BAR = "baz"; } define("TAZ", "qux"); echo "Foo::BAR={Foo::BAR} TAZ={TAZ}"; //Foo::BAR={Foo::BAR} TAZ={TAZ} echo…
-
-1
votes1
answer173
viewsA: In a login system, will all tables be connected with the user table?
That depends on what you want, I imagine three situations: Customers can schedule schedules, being the responsibility of the application to check if that time is valid and available. In this case…
-
1
votes1
answer25
viewsQ: Restructure table by dividing columns into rows
I have a table in the following structure: | campo1 | campo2 | campo3 | campo4 | | --------------------------------- | | valor1 | valor2 | valor3 | valor4 | | valor5 | NULL | NULL | valor8 | Among…
mysqlasked Costamilam 9,556 -
0
votes2
answers217
viewsQ: Use of chained static functions
I wanted to use static PHP functions as follows: class A { static function a1() { echo "A1"; return A; } static function a2() { echo "A2"; return A; } } A::a1()::a2(); Works, but shows this error:…
-
1
votes1
answer65
viewsA: Fixed values and values in javascript looping
Explanation in the code: let cont = 1; document.getElementById("add1").onclick = function clone() { let container = document.getElementById("saida1"); let tempLinha =…
-
2
votes2
answers843
viewsA: Random colors on buttons
The problem is that document.button does not contain all screen buttons, use document.querySelectorAll('tag') for this, then go through the array by modifying the style of each element <!DOCTYPE…
-
3
votes1
answer858
viewsQ: How to use Ngmodule modules and decorator?
I have doubts about how to use the decorators of NgModule. What they are and what they’re for? How to create a separate module to load one or more libraries and components? For example, one to load…
-
1
votes1
answer117
viewsA: background-color with animation and pulse
Based in that reply soen: jQuery(function($) { // MAD-RIPPLE // (jQ+CSS) $("[data-ripple]").hover(function(e) { var $self = $(this.parentNode); var $color = $(this).data("ripple");…
-
9
votes1
answer1332
viewsA: What _: and _
The underscore (_) is a variable. The point after it means that it is an object and is being accessed one of its properties let _ = { foo: 'bar', baz: v => `foo bar baz ${v}` } console.log(_)…
-
0
votes2
answers596
viewsA: How to use a dynamic url in angular projects 6
Environment is for you to define your variables that change between development and production They work very simply, they are two files, environment.ts for development and environment.prod.ts for…
-
1
votes3
answers2323
viewsA: How to do with CSS a checkered checkerboard background for Body?
html, body { width: 100%; height: 100%; margin: 0; padding: 0; } body { background: -moz-linear-gradient(45deg, #000 25%, transparent 25%,transparent 75%, #000 75%, #000 100%),…
-
5
votes3
answers1116
viewsA: Increase and Decrease Font, how to apply on a large site?
If I understand what you want: const btns = document.getElementsByTagName('button'); //Muda a fonte do corpo da página para 5px btns[0].addEventListener('click', () =>…
-
2
votes3
answers295
viewsA: What do I need to know in order to use React as my front-end library?
I will answer because I believe that these very broad questions can be answered with an introduction to their parts and, if necessary, the author can search for more information from those parts in…
reactanswered Costamilam 9,556 -
2
votes2
answers860
viewsA: error: Uncaught (in Promise): Error: Value must be an array in Multiple-Selection mode
As the documentation itself says: Error: Value must be an array in Multiple-Selection mode This error is thrown if you Attempt to assign a value other than null, undefined, or an array to a…
-
1
votes2
answers160
viewsA: Is there a way to place an image on top of a button or in the background?
Just set the property backgroundImage, don’t forget that your value should always be 'url(exemplo.png)' <!DOCTYPE html> <html> <head> <title>Page Title</title>…
htmlanswered Costamilam 9,556 -
1
votes1
answer67
viewsA: How to get information that is in 2 mysql tables
Use the clause JOIN of SQL: SELECT * FROM users as u INNER JOIN file as f ON u.id = f.userId WHERE u.level_id = 30 Explaining, line: Selects everything from the table users Together with the table…
-
3
votes1
answer499
viewsA: SQL - Condition with Between
Simply: $data2 = empty($data2) ? $data1 : $data2; $sql = "SELECT ... BETWEEN $data1 AND $data2;"; If the second date is done you receive the value of the first date if not the value itself, you can…
-
3
votes2
answers189
viewsQ: What data can I get from a user?
I am creating a Landing page that aims to capture as much information as possible from users who can become future customers So far I can get the location by geolocation in javascript (if the user…
-
2
votes1
answer125
viewsA: Grab information from a JSON file with spaces
I had the same problem, I had to consume an API that had properties with spaces and hyphens, use: obj["prop 1"]; obj["prop-2"]; obj["prop. 3"]; //...
-
5
votes2
answers1995
viewsA: What does "== $0" represent when inspecting a page?
$0 is a javascript variable that the developer tools (dev tools) create to make our life easier, when used in the terminal it references the element selected in the tab elements, therefore the ==…
-
0
votes2
answers173
viewsQ: How to validate data securely in the frontend?
According to that comment by @Pauloalexandre, it would be possible to validate the data only on the front, so that the back only receives the ready data I know that it is possible to limit, through…
-
0
votes1
answer37
viewsA: Place text inside the image
You can use the position: absolute; and change the location of the text with left , top, right and bottom For too wide texts you can use the max-width and set the maximum size span { position:…
-
0
votes1
answer201
viewsA: Warning: mysqli_real_escape_string() expects Exactly 2 Parameters, 1 Given
Missing to pass the connection object by parameter, for example: $link = mysqli_connect("localhost", "my_user", "my_password", "dbname"); $city = "'s Hertogenbosch"; $city =…
-
6
votes2
answers795
viewsQ: What is http/ftp 220 status?
Contextualizing... when trying to connect to the hosting server, by FTP, always returns the 220 status and, after a few seconds, disconnects by time Being a status of type 2xx is not an error…
-
0
votes1
answer118
viewsA: Doubt about query with parameters using Angularjs and http request get method
The problem is that the http get method by default does not accept a body and the method $http.get angular does not receive an object with parameters Send the parameters via url, for example:…
-
0
votes2
answers30
viewsA: Which way is more correct not to let a function run
Put the return after one die or exit it makes no difference, since both (die and Exit) will stop the execution of the program, that is, neither will it get to execute the return false; Remarks:…
-
1
votes3
answers1075
viewsA: Organize Divs into blocks over each other?
If you know the height value of the cantainer, you can do so: body { display: flex; flex-direction: column; flex-wrap: wrap; height: 60px; } <body> <div>DIV 1</div> <div>DIV…
-
-4
votes1
answer431
viewsQ: Is it possible to create a widget with javascript?
Javascript already has several Ads for push notification, vibration (only on mobile) among others, is it possible to create widget on the user’s desktop? Or, if this is a requirement of the project,…