Posts by marcelo2605 • 790 points
31 posts
-
1
votes1
answer79
viewsA: number_format() generates error only in Return
Problem solved. I made a mess between Accessors and Mutators. The final version looks like this: public function getValorAttribute($value) { $format = number_format($value, 2, ',', '.'); return…
-
1
votes1
answer79
viewsQ: number_format() generates error only in Return
Inside the table orders, I have a field valor defined as decimal(10,2). In the archive Order.php, I created a method to format the value: public function getValorAttribute($valor) {…
-
0
votes2
answers1430
viewsQ: Insert variable in regular expression
I need to change the name of the inputs after they are cloned. For example: order-recipient-name[0] would be order-recipient-name[1] and from there on. What I tried to: var current_counter =…
-
3
votes1
answer416
viewsQ: Protecting a route used by a single domain
I have an Laravel application hosted in a subdomain and need to allow your API (which has a single POST route) to be used solely by the application hosted in the main domain. What is the simplest…
-
1
votes1
answer17
viewsA: Avoiding arrays as values when using array_merge_recursive()
Solved: $vacancies = get_option('vagas'); $new_vacancies = array_merge_recursive($vacancies, $created_vacancies); foreach($new_vacancies as $key => $vaga){ foreach($vaga as $key2 => $horario){…
-
0
votes1
answer17
viewsQ: Avoiding arrays as values when using array_merge_recursive()
I have the following array: $vagas = array( '2017-09-22' => array( '11:30' => 2, '12:00' => 3, '15:00' => 1 ), '2017-09-23' => array( '9:00' => 5, '10:00' => 3, '11:30' => 2…
-
1
votes1
answer584
viewsA: Recurring payment with Cielo webservice 3.0
Solved: It is necessary to add the class at the top: use Cielo\API30\Ecommerce\RecurrentPayment; and instantiate the variable $recurrent: $recurrent = new RecurrentPayment(); $recurrent =…
-
1
votes1
answer584
viewsQ: Recurring payment with Cielo webservice 3.0
I’m testing the recurring payment example, available on official repository of Cielo and the code returns the following error: Fatal error: Uncaught Error: Call to a Member Function setInterval() on…
-
0
votes1
answer785
viewsQ: Consult bank on another server
I have a Mysql database and need to consult it from another server using PHP. What’s the best way to do this? It is possible to activate a function on the database server and make it return the…
-
1
votes1
answer384
viewsQ: Problems with file_put_contents()
I have a script that runs every time a particular page is loaded. Basically, it does a database search and saves the values in a file: $servicos = $db->prepare('SELECT id_servico,…
-
1
votes0
answers56
viewsQ: Redirect with . htaccess
I am using the following mod-rewrite rule RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)/([^/]+)/?$ index.php?lang=$1&page=$2 [L,QSA,NC] But now I…
-
1
votes2
answers89
viewsA: Replace number by string in results
Solved: SELECT sum(pedidos_lentes.quantidade) AS value, CASE pedidos_lentes.solar WHEN 1 THEN 'Yes' ELSE 'No' END AS label FROM pedidos JOIN pedidos_lentes ON pedidos_lentes.id_pedido =…
mysqlanswered marcelo2605 790 -
0
votes2
answers89
viewsQ: Replace number by string in results
I have the following query: SELECT sum(pedidos_lentes.quantidade) AS value, pedidos_lentes.solar AS label FROM pedidos JOIN pedidos_lentes ON pedidos_lentes.id_pedido = pedidos.id_pedido WHERE…
mysqlasked marcelo2605 790 -
0
votes2
answers31
viewsQ: Get the name of the files sent by the form
I’m trying to get the name of the files after sending the form: add_action('gform_after_submission_5', function ($entry, $form) { $file_url = $entry['5']; $filename = basename($file_url); }, 10, 2);…
-
0
votes5
answers946
viewsQ: Bootstrap: prevent the menu from closing when clicked out of it
I am using the following script so that the dropdown menu of Bootstrap does not close when clicking on some other point of the page: $(document.body).on('click', function(event){ var windowWidth =…
-
1
votes1
answer28
viewsQ: Return tags associated with posts
I use the query below to return all posts marked with the tag set: SELECT imprensa_posts.slug AS slug, tipo, titulo, data FROM imprensa_posts JOIN imprensa_tags_posts ON imprensa_tags_posts.id_post…
-
1
votes1
answer900
viewsQ: Using a variable created within an AJAX request in another function
I have a list of projects where, when the Thumb of a project is clicked, the script loads images related to the project. $('.project-grid').on('click', 'a', function (event) {…
-
6
votes1
answer57
viewsA: Resolution 176px not compatible with Media Queries
Following the logic you used, none of these rules apply to a 176px wide screen. See that you use the min-width. That is, the CSS will only be applied if the width is equal to or greater than the…
-
7
votes1
answer117
viewsQ: Include tag in the first word of a string
I don’t have much knowledge of regex, so I got this rule ready. $break_title = preg_replace('/(?<=\>)\b\w*\b|^\w*\b/', '<span>$0</span>', $title); return $break_title; The problem…
-
2
votes1
answer74
viewsQ: Create an array with dynamic variables
I needed to create dynamic variables and used this script: for($i=1;$i<=40;$i++){ ${"horario" . $i} = get_custom_field('horario'.$i); } It generates me the variables $schedule1, $schedule2, ...…
-
1
votes2
answers7523
viewsQ: Get the most recent month’s records
I have a simple table that stores titles and publication date, this in DATE format, and I need to get all records for the most recent month/year. select titulo, publicacao FROM teste1 ORDER BY…
mysqlasked marcelo2605 790 -
0
votes3
answers71
viewsA: Wrapping part of a string
Solved: $('.carousel .item .carousel-caption h2').each(function(){ var val = $(this).text(); var string = val.substr(val.indexOf(":") + 1); var re = new RegExp(string, "g"); var novo =…
-
2
votes3
answers71
viewsQ: Wrapping part of a string
I’m testing a function to select the part of a title that comes after the two-point sign: $('.carousel .item .carousel-caption h2').each(function(){ var val = $(this).text(); console.log(val); var…
-
10
votes5
answers74116
viewsQ: Removing a specific element in an array
I have the following array $input = array("item 1", "item 2"); But as it is dynamic, items can change $input = array("item 2", "item 4"); $input = array("item 4"); It is possible to use the…
-
1
votes1
answer126
viewsQ: Returning NULL
I am using this query: SELECT GROUP_CONCAT(coluna1) as valores FROM arquivos WHERE coluna2 IN (21, 22) It returns column1 values of lines whose column2 has one of the specified values. The problem…
mysqlasked marcelo2605 790 -
2
votes2
answers171
viewsQ: Generate a search url?
I need to get the search url for a specific term on a site built using Codeigniter. But when I type the term, the url changes only to: nomedosite.com.br/busca I tried to add ?q=arquitetura but it…
-
5
votes5
answers7269
viewsQ: Use if inside foreach
I’m trying to change the order in which the results appear within a loop using foreach. What I need is for the numbers larger than five to appear first, followed by the rest of the numbers. So I…
-
6
votes2
answers824
viewsQ: Name of months in Portuguese and English
On the site where I work, I use the following query to display in English the dates that are stored in the database: $conn->exec("SET lc_time_names = 'pt_PT'"); However, I discovered that the…
-
1
votes3
answers132
viewsA: Problems with table in IE
RESOLVED The problem was in the :before tbody:before { line-height:10px; content:"-"; color: transparent; display:block; } I switched to: tbody:before { height:10px; content:""; display:block; }…
-
3
votes3
answers132
viewsQ: Problems with table in IE
In IE, the cells of the tbody do not accept CSS values. td:first-child{ width: 52%; } I created a jsFiddle with the table html/css: http://jsfiddle.net/rqj6r/1/…
-
3
votes1
answer227
viewsQ: Using Cycle2 and "picturefill" together
I created a slideshow responsive using Cycle2. Because the images are very large, I need to upload a smaller file of each image when the page opens on mobile devices. So I thought I’d use the…