Posts by Leandro Marzullo • 1,401 points
132 posts
-
1
votes1
answer25
viewsQ: To create an exception in htaccess mod_expires
I have a website that I use mod_expires to cache, but I didn’t want to apply to all pages, because the home page, for example, is dynamic, changes every day. There is how I create an exception rule…
-
1
votes0
answers40
viewsQ: How to put a div overlaid to a video embed in fullscreen?
How can I have a div superimposed on a Youtube-soaked video? I wish in the case below, the div id="banner" stand in front of the video when it is fullscreen: <iframe width="560" height="315"…
-
0
votes1
answer59
viewsQ: How to group items from an array with the same category in PHP
I have a array in PHP that follows the following pattern: array(3) { [0]=> array(3) { ["id"]=> string(1) "1" ["categoria"]=> string(7) "Celular" ["produto"]=> string(8) "Motorola" }…
-
0
votes0
answers21
viewsQ: Slow MYSQL query, when searching for date
I’m doing a date search on mysql, but it gets very slow (more than half a second). Is there any way to optimize this search to get faster? Ex: of consultation: SELECT dt.data,count(d.id) AS…
-
1
votes1
answer42
viewsQ: How to make MYSQL SELECT "create" the days you don’t have in the table
I’m doing a MYSQL query that returns a download report a day, but in a few days it has no download. For example: ID|data 1 |2020-05-20 2 |2020-05-21 3 |2020-05-23 In this case, there was no download…
-
0
votes1
answer38
viewsQ: How to select in MYSQL, bringing together results
I need to make a query that returns the amount similar to the below: TIPO 1 unidade 1 unidade 2 unidade n TIPO 2 unidade 1 unidade 2 unidade n The tables are like this: tabela_tipo id|tipo 1 |TIPO 1…
-
0
votes1
answer90
viewsQ: How to use . click on jQuery after return from ajax
I have an ajax function that returns content with a button. I would like to call another function triggered by the button that the ajax returned, as in the example below: <button id="procurar"…
-
-1
votes1
answer291
viewsQ: How to replace two or more hyphens or spaces with just one hyphen
I’m building a blog and I need a script to get the title of the post and generate a link (without accents and spaces), as you write. I rode this one below, but I could not ignore 2 hyphens in a row,…
-
3
votes2
answers177
viewsQ: How to insert objects using canvas (javascript) and avoid 2 objects in the same position
I’m doing a canvas test to randomly insert various polka dots into a rectangle. I use a random position for each ball, as long as the limit is less than the width of the rectangle. So far so good,…
-
0
votes1
answer151
viewsQ: How to get the items inside an Object(stdClass) in PHP?
I’m importing with PHP for an api, and I don’t know how to get the values of object(stdClass) who are inside the $fotos. I tried it both ways below, but I believe I’m wrong: foreach($fotos as $f){…
-
0
votes1
answer77
viewsQ: How to send parameter in array using Curl in php
I am integrating an API that imports immovable information using Curl in PHP. I stopped to import the photos, in the documentation he says: QUERY PARAMETERS dimensions Array of strings Items Enum:…
-
2
votes2
answers822
viewsQ: Regex to pick sequence of letters or numbers
I have a website where I do a lot of youtube embed, so to make it easier I thought about using {youtube 54sd3} for example, and at the time of printing the result it replaced with: <iframe…
-
-1
votes2
answers847
viewsQ: How to "bypass" the Maximum Execution time of 30 Seconds exceeded in php?
I have a script that imports the properties of a real estate by an xml. When there are many properties, it gives timeout after 30 seconds (Maximum Execution time of 30 Seconds exceeded). Is there…
-
0
votes0
answers29
viewsQ: How to Recover Deleted Lines from MYSQL?
I unintentionally deleted some rows from mysql, because of a LIKE misspelled. There’s a way I can get those lines back? I don’t know if it helps the answer, but the delete command was: DELETE FROM…
-
-2
votes1
answer93
viewsQ: php function cannot compare words with accents
I have a function that compares 2 words, but when removing the accents, it still identifies as different words: function acento($str, $from, $to) { $keys = array(); $values = array();…
-
1
votes0
answers47
viewsQ: How to use different images in the background-image, according to screen size?
I’m optimizing a site and wanted to know if I have how to use different background-image according to screen size. For example, screens larger than 640px use the image /referent123/original.jpg and…
-
1
votes2
answers235
viewsQ: How to do a search in MYSQL considering plural and singular
I have a recipes site with a simple search system. But there are recipes that are plural and recipes in singular, for example: chocolate biscuit and chocolate biscuit When someone looks for a…
-
2
votes1
answer473
viewsQ: How to count the number of empty columns in MYSQL
I have a MYSQL client registration database. I need to make a query to know the amount of blank columns each record has. For example, in total I have 15 columns (name, email, address, etc) and "So"…
-
1
votes1
answer251
viewsQ: How to search for relevance in Mysql (prioritize whole word)
I have a recipes site in PHP and Mysql. The consultation is: SELECT receita FROM receitas WHERE receita LIKE '%mac%' When I search for "mac", it brings "macaroni" and "big mac". I wanted the result…
-
4
votes2
answers105
viewsQ: How do I treat a jQuery array (remove duplicates and prevent an item from appearing in 2 arrays)?
I have 2 arrays (like and notlike) and as I give like or notlike, it adds the item in the array, currently it is like this: //DEFINE ARRAYS like = new Array(); notlike = new Array(); //SE CLICA NO…
-
3
votes1
answer464
viewsQ: Error importing image: Allowed memory size
I’m using a simple script to crop the image, while cropping some images it gives this error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 155648 bytes) in…
-
-1
votes2
answers61
viewsQ: How to cut a PHP string in <H2> tags
I have a recipes website where the ingredients are separated into blocks, for example: $ingredientes='<ul> <li>100g de farinha de trigo</li> <li>1 ovo</li> <li>2…
-
-2
votes2
answers1074
viewsQ: Generate random time within a range
I have a function that generates the current time, time +12hs and time +24hs. I need him to run a random schedule within that 12-hour and 24-hour window. I got the following: //DEFINE HORARIO DE…
-
1
votes1
answer443
viewsQ: How to separate the results of a SELECT in MYSQL into 2 foreach in PHP?
I have a recipes website where I bring the list of recipes according to the query below: SELECT * FROM receitas WHERE titulo LIKE '%batata%' ORDER BY ordem I wanted to show the first 3 featured…
-
4
votes2
answers571
viewsQ: How to convert jpg images to webp using php?
I’m setting up a real estate website that imports photos of an xml. I wanted that when importing, it converted jpg to webp, but of the ones I found on the net, I could not make it work. Does anyone…
-
0
votes1
answer1457
viewsQ: How to get form values before Submit with jQuery?
There are ways, before the form is sent, I can get the values of each form input using jQuery?
-
1
votes0
answers14
viewsQ: How to update multiple lines in mysql?
I have a table (respostas) MYSQL thus: ID|resposta 1 | A 2 | B 3 | B 4 | C Then when sending the form below it should update the response column according to the value of each input: <form…
-
1
votes0
answers73
viewsQ: Position "Fixed" moves when scrolling down the page on mobile
Create a div with position:fixed;top:0. In the computer is normal, and does not move independently if I go down or raise the screen, but in the cell phone when I go down the screen it comes out, but…
-
0
votes0
answers93
viewsQ: How to change the order of values within a PHP array?
I have the following array: $arraymaterias=array('his;51','mat;60','mat;60','mat;60','mat;60','mat;32','por;60','por;60','por;60','por;60','por;60','por;60','por;60','por;37'); I wanted her to…
-
4
votes2
answers238
viewsQ: How to search MYSQL search for word in title and then in text and sort by title first
I have a table with title and content and wanted to do a search to see if the term is in any of these fields. If you have, bring the results of the title first and then the content tabela…
-
0
votes1
answer505
viewsQ: Convert sum of minutes to hours format (eg 70min = 01:10) with jquery
I have the following script that takes the hours and minutes of each day of the week, where the variables that start with m are the minutes of each day of the week (coming from a select) and those…
-
0
votes1
answer108
viewsQ: Check if input value contains specific word, using jQuery
I’m creating a function to take the youtube link written in an input and take the image of this video. To get the image just use the link below, changing the video id (value v=) by youtube link:…
jqueryasked Leandro Marzullo 1,401 -
-1
votes1
answer71
viewsQ: How to order query in MYSQL by relevance? (first results that the term is in the title, then in the content)
I have a table as follows: id|nota|titulo |ingredientes 1 | 3 |pão de batata|batata;farinha;agua;ovo 2 | 2 |bacalhoada |bacalhau;batata;pimentão 3 | 1 |batata frita |batata When I do a search that…
-
8
votes3
answers650
viewsQ: What is the best way to build a Mysql table with recipe items? All ingredients in one row or one ingredient per row?
I’m used to creating websites with few database records, so I don’t care about the speed of query and I have no experience with large volumes of information. But now I am creating a website recipes,…
-
0
votes1
answer111
viewsQ: How to relate 2 arrays (array1 is name and array2 is ID) and bring the corresponding value
I have 2 arrays, where one is an array with the names and the other is an array with the ids. I need that according to the name of the string (which it contains in the $name array), it searches in…
-
0
votes2
answers136
viewsQ: How to group array that has the same value
I have the following string that is converted into an array that represents: "Question;Matter ID;Answer": //PEGANDO AS REPOSTAS…
-
2
votes1
answer123
viewsQ: How to compare responses and templates where each is a PHP string
I have 2 PHP strings that are the student’s responses and feedback. I need to compare them and show the result in a table: $respostas='1;A|2;B|3;C'; $gabaritos='1;A|2;B|3;D'; I need him to generate…
-
-1
votes1
answer1359
viewsQ: How to redirect site to another folder at public_html level using htaccess
I have a website created and the files are in the public_html folder. We created a new one in the 2018 folder that is at the same hierarchical level as public_html How can I access domain.com.br, it…
-
-3
votes1
answer792
viewsQ: Very slow MYSQL query, more than 25 seconds, how to improve?
I have a query in mysql that is very slow , more than 25 seconds. The base is quite large, around 1,000 records of real estate (table osrs_properties) and 16,000 photo records (table osrs_photos).…
-
-1
votes1
answer66
viewsQ: Image upload rotates vertical image
I have a script that uploads the images and creates 2 files: width 1200 and width 50. It works normally, but when the photo is vertical (height greater than width) it rotates the image in upload…
-
0
votes0
answers36
viewsQ: How to apply a filter in XML to import the records using PHP?
I have an XML with several records to make an import with PHP. The importing part is ok, but I wanted to make a filter before importing, for example, import only the record that has ID 444, how can…
-
0
votes0
answers40
viewsQ: I cannot import all xml sublevels with PHP
I have a function to import the xml file: $xml = new SimpleXMLElement($arquivoxml); foreach($xml->Imoveis->Imovel AS $itens) { $ref=$itens->Id; $atributospai = $itens->Atributos; foreach…
-
0
votes2
answers67
viewsQ: How to compare 2 arrays to find which value is missing in one of them, using PHP
I have 2 arrays and need to make a comparison between them, to find what values are missing in the 2nd array ($arrayxml), for example: $arraybd=array('1','2','3','4'); $arrayxml=array('1','2'); In…
-
0
votes2
answers2541
viewsQ: How to make a select inside another select in mysql
I need to take the lowest value of a column to use it as a condition in where, but I don’t know how to do that. The column I need is the ordering, as below: SELECT p.pro_name, p.id, f.image as foto…
-
0
votes1
answer78
viewsQ: How to import photos from XML with PHP
I am trying to import an XML file, but do not know how to import when there is a field inside another field, see below the example that explains better: <imovel> <id>1</id>…
-
0
votes1
answer128
viewsQ: Use PHP array and bring results in multiple rows
I have an array $_POST['form']['clima'] that in this example has the value below array(2){ [0]=> string(1) "1" [1]=> string(1) "2" } I need to take these values to join with $id (in this…
-
0
votes1
answer183
viewsQ: How to take the value of $_GET['sealed'] to leave the checkbox selected using PHP
I have an array in PHP that are the values selected from the checkbox, which were obtained by $_GET: $_GET['selecionados'] = array(2) { [0]=> string(1) "a" [1]=> string(1) "b" } There I have…
-
3
votes2
answers746
viewsQ: Count how many fields are empty on a MYSQL line
I have a registration table with 53 columns (address, phone, etc). I wanted to set up a consultation that would bring me how many of these columns are empty or NULL, how can I do that?
-
0
votes2
answers484
viewsQ: How to pass varivlle from a PHP file to another PHP file
I have a script that generates a pdf file. The file name is set in Mergepdf.class.php But I wanted it to be set in the source file (variable $filename), where it calls this php, which is below:…
-
2
votes3
answers593
viewsQ: How to get all $_POST information
I have an array sent by $_POST: array(4) { ["gabarito"]=> string(1) "4" ["resposta1"]=> string(1) "A" ["resposta2"]=> string(1) "B" ["resposta3"]=> string(1) "A" } I need to take this…