Posts by Mastria • 1,133 points
47 posts
-
3
votes3
answers940
viewsA: Compare the same variable in PHP
Test like this with the operator && comparative: if ($email !='[email protected]' && $email !='[email protected]') { echo 'alerta aqui'; } Or, using array, so you can insert as many…
-
0
votes1
answer1332
viewsA: Update after typing without refresh
Try this way more simplified, I made some updates in the form for the button to have an id (the same of the category) and the text field to have an id too (s+id_category), I changed the Submit to…
-
0
votes1
answer60
viewsA: Print all images from another table without repeating the title
A simple way to solve this is: First let’s organize the data by post title followed by image id: SELECT * FROM posts, imagens WHERE posts.id_post = imagens.post_id AND slug=:slug ORDER BY…
-
2
votes1
answer26
viewsA: Filter the first result of PHP explodes function and present in a structure
Try: unset($separa[0]); And do the foreach
-
0
votes3
answers2318
viewsA: How do I zoom into a css or javascript page?
Try this: <script type="text/javascript"> function zoom() { document.body.style.zoom = "300%" } </script> <body onload="zoom()"> <h6>content</h6> </body>…
-
-1
votes2
answers1543
viewsA: Search the database and display with while
Your question is very comprehensive, first search how it works to fetch the data, follow a referral link: http://pt-br.html.net/tutorials/php/lesson20.php So in case you have any questions post…
-
0
votes3
answers355
viewsA: Gmail displaying source host on recipient when using PHP mail()
Include the desired information in the header, example: $headers = "MIME-Version: 1.1".PHP_EOL; $headers .= "Content-type: text/plain; charset=iso-8859-1".PHP_EOL; $headers .= "From: Meu Nome…
-
1
votes2
answers548
viewsA: Start php script in background
I believe the solution you are looking for is a scheduled task (Cron Jobs), read more about how to use here I hope it helps.…
-
1
votes2
answers47
viewsA: Final date in D/M/A on a given number of days
Follow the way I use: $qtdeDias = 5; echo strftime('%d/%m/%Y', mktime(0, 0, 0, date('m'), (date('d')+$qtdeDias), date('Y'))); Read more about the functions in the documentation: strftime mktime I…
-
1
votes2
answers619
viewsA: Pass array to Modal
If you want to print array specific data, you need to print so: echo $details[0]['dt_detalhes']; He will print the field dt_detalhes of the first array item 0 If you want to print all fields and…
-
2
votes2
answers75
viewsA: Use Inner Join with <ul> and <li>
I believe that the solution you are trying to find ends up complicating your project even more. Anyway it will duplicate unnecessary lines and bring irrelevant data to your query. Try in the most…
-
0
votes2
answers41
viewsA: Slowly recount the number of records in a table
You can use a meta tag to refresh your page from time to time: <meta http-equiv="refresh" content="5"> // 5 segundos Or by AJAX, explained its operation here: php calls by ajax…
-
5
votes8
answers1094
viewsA: Is it recommended to use constants for configuring a PHP project?
Passwords and access data I already prefer encapsulate and only my connection class/or similar have access to this data. I think any form of variable too accessible somehow compromises the security…
-
0
votes3
answers253
viewsA: Is it possible to modify a field before performing a search? (PHP MYSQL)
Yes, you can use the function REPLACE(), follows an example: SELECT * FROM tabela WHERE REPLACE(conteudo, 'procura', 'substitui') LIKE '%$pesquisa%' I hope it helps…
-
0
votes1
answer56
viewsA: Save tab-pane active when updating the page
When I need something like this I use this library jquery-cookie The syntax is very simple: Create: $.cookie('name', 'value', { expires: 7, path: '/' }); Read: $.cookie('name'); Rule out:…
-
1
votes4
answers201
viewsA: Simplify IF instructions in PHP
Another way to reduce your comparison is: if($d1.$d7.$d8.$d9.$d5 == 11111) echo 'ganhou 12 pontos'; Or more precise: if($d1.$d7.$d8.$d9.$d5 === '11111') echo 'ganhou 12 pontos'; It is quite…
-
2
votes2
answers958
viewsA: Take a line ID that has just been created in PHP
You can use the following SQL: SELECT LAST_INSERT_ID() as id FROM tabela
-
0
votes3
answers2091
viewsA: Place an image in the center of another image in PHP
The easiest way is to superimpose an image on the other, create a 300x300 white image to serve as a base, I really like using the library Wideimage, is light and without many complications, follows…
-
3
votes1
answer42
viewsA: Check 2 values after . (point)
Try to use the function Ceil, I think it helps you in this case. Hug
-
0
votes1
answer20
viewsA: Update Page If Query Return False
$consultapedidos = mysql_query("SELECT * FROM pedidos WHERE produzido = '0'"); if(mysql_num_rows($consultapedidos)==true){ while($lnped = mysql_fetch_array($consultapedidos)) { } } else { echo…
-
2
votes1
answer362
viewsA: Send Selected Checkbox
Change the attribute name from your checkbox to: <input type="checkbox" name="adicional[]" value="Confete" id="2.00"> So PHP will receive an array of objects, when receiving normal:…
-
4
votes2
answers5870
viewsA: Insert gif 'loading' while performing function
Create two divs in your html: <div id="blanket"></div> <div id="aguarde">Aguarde...</div> Next we will apply the css: #blanket,#aguarde { position: fixed; display: none; }…
-
2
votes1
answer57
viewsA: Doubt about PDO connection
Just remove the snippet of the code that does the search and manually put the values in the variables declared above, and NEVER put database password in txt files or files that are read through the…
-
0
votes4
answers2455
viewsA: Serial Communication With PHP and Arduino
Ever tried via socket? Follow a basic example: $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_connect($sock,"187.15.6.131", 8081); // Ip e porta que você configurou no seu arduino…
-
4
votes1
answer7488
viewsA: How to count down with jQuery?
Have some plugins already ready that it is possible to do this without much headache, follow two examples: 1 - Flipclock (already with css): <html> <head> <link rel="stylesheet"…
-
1
votes2
answers232
viewsA: Restrict access to a folder on the server after login
Come on, according to what you’ve been through, the nominee would be to create a rule within each php file that is in each folder (somewhat repetitive, and less practical, but meets its rule):…
-
1
votes1
answer479
views -
5
votes2
answers2784
viewsA: How to concatenate PHP variable with Mysql column?"
To concatenate two or more fields in Mysql use the function CONCAT as follows: $sql = "SELECT CONCAT('".date('Y-m')."', '-', diaVencimento) AS data FROM pagamentos"; or $sql = "SELECT…
-
0
votes1
answer312
views -
6
votes1
answer1835
viewsA: php registration form NO database
Make the basic form in html in a file index.php: <form method="POST" action="./"> <input type="text" name="nome" /> <input type="submit" value="Cadastrar" /> </form> After…
-
2
votes2
answers412
viewsA: Problems to convert data mon dd yyyy hh:mm
Try to use the function FORMAT in SQL, as the example below: SELECT FORMAT(ven.DATA, 'dd/MM/yyyy', 'en-US') AS 'data'; Or format in PHP: $parsed = date_parse_from_format('M d Y H:i:s:B', $data); //…
-
1
votes2
answers1114
viewsA: How to connect two SELECT (combobox) in PHP and do Auto Fill?
The most practical way would be to use ajax, create a function in jquery: (function($){ $.subcategoria = function(id) { if(id != '') { $('select#subcategoria').html('<option…
-
0
votes2
answers1898
viewsA: Read a Serasa Data String
try to use file_get_contents(), remember that to stop using a URL the option allow_url_fopen in your php must be active. Hug…
-
0
votes1
answer42
viewsA: Slide error when inserting php code
Invert double quotes for single, see if it works. echo '<div> <div u="player"> <iframe pHandler="ytiframe" pHideControls="0" width="640" height="381" style="z-index: 0;"…
-
2
votes1
answer1972
viewsA: Perform mysql query of two tables via php
A question, every person must have a vehicle? Use the simplified way (without JOIN) and see if it works, otherwise let us know the error generated: SELECT p.id, p.nome, v.modelo FROM pessoa p,…
-
2
votes4
answers941
viewsA: Time Sync() PHP and Javascript
I believe the function you seek is date_default_timezone_set Example of use: date_default_timezone_set('America/Sao_Paulo'); At this link, you find the supported Timezones. Read more about, in the…
-
3
votes1
answer320
viewsA: Assign value to input text
Test like this instead of using the function .text() use the .val(): $('#img').draggable({ drag: function () { var offset = $(this).offset(); var xPos = offset.left; var yPos = offset.top;…
-
0
votes1
answer153
viewsA: Calendar php with login
Exactly as you thought, the basic structure of the database would look something like this: [USUARIO] id_usuario login senha [LINHA] // Como chamou id_linha id_usuario // Correspondente a quem está…
-
1
votes1
answer915
viewsA: Show products by category parameter in a more optimized way
Since each one has its own way of programming, we will emphasize its query, the way I consider it most correct would be to create a table categoria and then create a foreing key on the table of…
-
2
votes3
answers626
viewsA: How does php guarantee a single session_id?
I usually use the user’s IP ($_SERVER["REMOTE_ADDR"]) with timestamp in seconds from the time of creating the session using the function team() along with some keyword, all this convert to md5…
-
3
votes3
answers3234
viewsA: Browse data from 1 day to 3 days ago mysql
You can use in some ways, among them: Passing the date you want by direct parameter by PHP: $pesquisa = mysql_query("SELECT sum(ProdValor) FROM vendas WHERE data = '".date('Y-m-d')."'"); $pesquisa =…
-
1
votes1
answer48
viewsA: Select by deleting another Select
Without the bench in hand it becomes difficult to test, but test this way, you don’t need the OFFSET because the first four will be ignored in NOT IN: SELECT * FROM noticias WHERE idnoticia NOT IN…
-
4
votes1
answer586
viewsA: PHP OO Problems with Classes
Your user will always come back empty, by registering comment you are creating a new (empty) User instance and sending to the method $usuarioDAO->logar($usuario);. You are not sending any…
-
2
votes1
answer430
viewsA: How to return only the last result of more than one field of the same table?
Before starting your first while declare the variable $_autor, and within the loop create the following check before searching and printing everything, so: // Declare a variável como nula $_autor =…
-
0
votes1
answer272
viewsA: Trying blocked Phpmailer login
Already downloaded the latest version of Phpmailer? Apparently your code has nothing wrong, I tested it here and it worked perfectly. Check your password, exchange it and do simple test isolated as…
-
0
votes2
answers1032
viewsA: How to store GPS coordinates in a PHP web application?
Interesting project model, I believe mysql would not have problems in saving this amount of data, but a Nosql database I believe would be a more appropriate solution! Also review this interval of 5…
-
1
votes1
answer412
views