Posts by Manuel Gerardo Pereira • 1,179 points
45 posts
-
2
votes2
answers354
viewsA: How to separate items from an object array by dynamic types?
You have to remake the object var a = [ { id: 1, name: 'maria', tipo: 'pessoa', }, { id: 1, name: 'joao', tipo: 'pessoa', }, { id: 1, name: 'tareco', tipo: 'animal', }, ]; var b ={}; for (var i = 0;…
-
0
votes2
answers4429
viewsA: Go back to PREVIOUS screen without losing "INFORMATION" from previous screen
Your question can be solved by javascript / Html5. This is the solution I would implement: screen 2 would be modal (open on top of screen 1). When the user clicks on the button the required data on…
-
1
votes1
answer445
viewsQ: How to pass a stored parameter with escaped characters?
I am using php and mysql and would like to pass the following parameter to a stored Procedure $param = "col = '{"video":"<iframe width=\'480\' height=\'600\' src=\'www.qualquercoisa.com\´"}'";…
-
3
votes1
answer710
viewsQ: Change array keys returned by mysqli_result
I need to change the keys of a result obtained by mysqli_result->fetch_assoc() If I do this research : "SELECT exemplo.nome, exemplo.apelido, exemplo.idade FROM exemplo WHERE exemplo.id=1" get…
-
8
votes2
answers13586
viewsA: Use of $_REQUEST instead of $_GET, $_POST and $_COOKIE
It depends on how much trust you have in the customer’s data. If you are sure that there is no repeated key, that is, there is no simultaneous sending of $_GET['bubu'], $_POST['bubu'],…
-
2
votes4
answers3553
viewsA: How to get the next element in a PHP foreach
With the foreach may not be the best solution, but you can do with the each(), which returns the current element and moves the pointer forward an element. It would look like this: $arr =…
-
1
votes2
answers1688
viewsA: Handling $_GET with line break
To display 2 lines you have to break the string and repeat the text creation. That is anything of this type: <?php $tamfonte = 25; $fonte = 'verdana.ttf'; $texto = explode("qualquer_separador",…
phpanswered Manuel Gerardo Pereira 1,179 -
1
votes2
answers215
viewsA: Max larger size of 2MB when uploading Docman files
Try to change the limits at runtime. Add these lines at the beginning of your script ini_set("memory_limit", "64M"); ini_set("upload_max_filesize", "16M");
-
0
votes2
answers877
viewsA: turn text into link
If I understand well what you want is to take the url only of "Anchor" tags and when you run the code it takes everything that is url. So you just need to make this little change to the code that…
-
3
votes4
answers1308
viewsA: I cannot concatenate variable in a query
This url certainly uses Apache’s Rewrite engine, so it’s easier and more reliable to edit htaccess and do things like this: RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([0-9]+)$…
-
2
votes1
answer204
viewsA: Error Uploading File to Database
This is because it is only the temporary file name and not a path(path) for the file. So first you should know where your server stores the temporary files and add the path to that file and add.…
-
3
votes3
answers4546
viewsA: How to make a foreach for an array of arrays?
You can do it like this: $ar = array ( [option1] => 2 [option2] => array ( [name] => "ola mundo" [id] => "123456" ... ) ... ) foreach($ar as $value) { if(!is_array($value)) continue;…
-
8
votes2
answers266
viewsA: Insertion in Mysql with PHP works for nothing
If you copied and pasted the error is to open the connection with mysql_connect and then use the methods of class mysqli. When you use, for example, mysqli_query(), is calling a method of class…
-
1
votes2
answers653
viewsA: How to execute via JS the action of a send email button, whose ID always changes?
First step find the button. We know that it is a div and that it has two attributes that do not change. Then: //buscamos todas as div var a = document.getElementsByTagName("div"); //vemos a que tem…
javascriptanswered Manuel Gerardo Pereira 1,179 -
2
votes5
answers7871
viewsA: Add onclick event to created element with createelement
What javascript framework are you using? The correct syntax is document.createElement(tagName) and its syntax is : createElement( 'button', { cName : 'fs-continue', inner : 'Proxima', appendTo :…
javascriptanswered Manuel Gerardo Pereira 1,179 -
2
votes3
answers212
viewsA: What is the reason for this IF/ELSE assignment?
The value 0 is not assigned to the IF. IF only evaluates whether the parameter you passed is true or false and to make this assessment uses the criteria that were explained above. So if it is passed…
-
0
votes2
answers2006
viewsA: How to insert dynamic tables referring plots
If I understand what you’re trying to do, you must do the following: 1) In the form, create a div with id="tuition fees" a select field with the possible number of tuition fees. In select add an…
javascriptanswered Manuel Gerardo Pereira 1,179 -
2
votes2
answers253
viewsA: Replace in large string or split loop
Trying to answer in a logical way. I have a principle that helps me to solve some problems. In this case it would be like this: strings -> string functions, arrays -> array functions The…
-
4
votes2
answers1160
viewsA: How to access JSON values from ajax in a PHP page?
The json_decode() function with the second TRUE parameter transforms the json object into an associative array, tentative; $numeros = $data['numeros']; $jogo = $data['jogo']; Another aspect: you…
-
2
votes2
answers1770
viewsA: random background-color on div without the same color repeating twice consecutively
Can solve in a simpler way: <?php $cor = array(); $cor[1] = "#CFF"; $cor[2] = "#9FF"; $cor[3] = "#600"; $cor[4] = "#FF0"; $cor[5] = "#C69"; $cor[6] = "#0F0"; //altera de forma aleatória os…
-
-1
votes1
answer6040
viewsA: How to fix "Undefined variable" error?
The reason you are not able to access the variables is because the short_open_tags option comes by definition off and you are using this option to insert php into html. php can be inserted into html…
phpanswered Manuel Gerardo Pereira 1,179 -
6
votes3
answers317
viewsA: What are the most common problems and dangers when enabling `register_globals` in php?
Whenever you enable register_globals you are authorizing the entire world, through an http request, to create and subscribe variables in your php script. Each http request is transformed into a…
-
7
votes12
answers5446
viewsA: How to remove accent in upload with php?
Place at the beginning of the script ini_set("default_charset","UTF-8"); or uses $nome = utf8_encode($_FILES['myfile']['name']); It should resolve, at least the name is right, but does not remove…
phpanswered Manuel Gerardo Pereira 1,179 -
-1
votes5
answers3979
viewsA: Footer alignment
Do the following : div#slides-container { height: 250px; overflow: hidden; width: 960px; padding-top: 40px; margin: auto; } Remove the div footer inside the container and do the following <div…
-
3
votes2
answers14672
viewsA: Refresh the contents of a page without reloading it
I don’t have much time to create the code today, but I think I should have the skills to do this: 1) add an id to the checkbox: echo "<input type=\"checkbox\" name=\"ids[]\" value=\"" .…
-
1
votes2
answers184
viewsA: Optional shopping cart
Your problem starts with the client and is transported to the server. To begin solving, switch the checkbox to select and create an order form <form name="pedido"> <label >Bife (adicione…
-
1
votes2
answers1523
viewsA: Group keys from an array
It’s not a great solution, because if the array is too large, it takes a long time. Let’s say it’s almost a gambiarra, because to use this solution and your problem must be deep. $atrib = Array( 0…
-
6
votes1
answer498
viewsA: Zero left inside integer variable
Because the 015 is the octagonal representation of the 13th decimal. copied from the manual <?php $a = 1234; // decimal number $a = -123; // a negative number $a = 0123; // octal number…
-
0
votes4
answers1051
viewsA: How to do if and Else of between 2 variables with output in a third?
Let’s see if this is what you want. To better understand, some considerations: a) In /folder/config.php all would-see are characteristics of a server then it is better to group them in an array. So…
-
0
votes2
answers281
viewsA: Save visitor IP in text file, but how not to save again if already there and how to read?
Some considerations: a) Save your file as json, as it may always use it in other languages. It could be something like this : {"ipss":["111.111.111.111","222.222.222.222"]} and save as…
-
0
votes4
answers1051
viewsA: How to do if and Else of between 2 variables with output in a third?
Try to do so include_once("/pasta/ip1.php"); include_once("/pasta/ip2.php"); function validar_ips($ip1,$ip2){ //verifica de o ip é válido $ip1 = (filter_var("111.111.111.111", FILTER_VALIDATE_IP)) ?…
-
0
votes2
answers14405
viewsA: Run Javascript function in event by clicking a button inside a table
It seems to be all right. Have you run some debug tests? If not, try: console.log("nbtn = " + $('#tbl .btn').length); $('#tbl .btn').click(function () { alert("ok"); var Qtd = $('.qtda'); var Id =…
-
1
votes2
answers153
viewsA: Reorder ID in table after Delete or Insert
When something gets crooked late or never straight. I would do so: - reorganize the table, leave the right Ids. It is not difficult, but it can take or spend a lot of resources select id from table…
phpanswered Manuel Gerardo Pereira 1,179 -
0
votes4
answers687
viewsA: include_once has no access to properties, variables or functions of the included file
In a normal function the include or the require has variable scope, that is, the file is only available within the scope of the function that calls it. When a file is included, the code it contains…
phpanswered Manuel Gerardo Pereira 1,179 -
2
votes3
answers1008
viewsA: Solution for <select> with many options
With this function you are free to use numbers or letters and you can also put the different value of the text in your options to select. $dias = range(1,31);//array 1 a 31 $cont = 5;…
-
3
votes3
answers1452
viewsA: Validate URL with ER
I use this regex and am satisfied with the results…
-
5
votes3
answers327
viewsA: Fatal error: Maximum Execution
I find it strange to say that the code works perfectly, because it gives a "fatal error" which means that the engine stopped processing the script due to an error. And it says he stopped processing…
-
-6
votes2
answers6461
viewsA: Select in Mysql with an array
I would do so: <?php $conect = mysqli_connect("localhost","root","","XXXXXXXXX"); $fornecedor = $_POST['fornecedor']; foreach($fornecedor as $value){ $sql = "SELECT id FROM fornecedores WHERE…
-
0
votes3
answers241
viewsA: Hosting php website
Are these directories outside the web access directory? Try using at the beginning of the script <?php set_include_path(/var/www/html/viewsmodel/); set_include_path(/var/www/html/service/);…
-
2
votes1
answer88
viewsA: Repeat For Error Function
It gives error because you set the function estaParaExperience within a loop, which causes each loop cycle and function to be declared and a function can only be declared once within its scope. Here…
phpanswered Manuel Gerardo Pereira 1,179 -
3
votes1
answer100
viewsA: Dynamic image and SEO behavior system
Whenever you think about SEO, think about text. If you want to get a closer idea how a search engine views your page use Lynx ( a browser that only reads text). Google says it doesn’t read the…
-
0
votes4
answers28473
viewsA: Align text after image
Here it depends a lot on the effect you want. If you want the text to wrap the image you should use the float as in the solutions that have already been presented. Now you want to make two columns,…
-
1
votes3
answers3156
viewsA: Position image to the right and top
Have you checked whether the <a> and the <img> are zeroed? a{ padding:0; margin:0; } img{ border:none; padding:0; margin:0 } In the last case try to place the parent element of the…
-
3
votes2
answers267
viewsA: Does replacing <a> with <span> cause problems in the page’s SEO?
If what you want is to undo the action of the element <a> use javasctipt Event.preventDefault() and keep your HTML correct. The links are of utmost importance to get good SEO, but for a good…
-
0
votes2
answers2112
viewsA: Fixing Elements in the DIV
In this case the width of the div search cannot be greater than 32%, since the div is 67% on the left (67%+32=99%). Also remove the input size. Set the font size of div search to font-size:16px (or…