Questions tagged as 'php'

2
answers

How to create a csv from a database query and data

I was able to create a perfect .xls file, but .csv can not, it follows the code I used to create .xls $dadosXls = ""; $dadosXls .= " <table border='1' >"; $dadosXls .= " <tr>"; $dadosXls .= " <th&...
asked by 10.11.2015 / 14:31
2
answers

Show loop result in real time

I'm using a loop to send mail from an array. Each time the loop runs the sleep(4); function is executed. The problem is that the output of php only happens at the end, ie the echo "</br>n:".$ne."&nbsp".$user["email"]."<...
asked by 19.01.2016 / 17:14
1
answer

What is the difference between readfile and file_get_contents?

In PHP, there are numerous ways to read the contents of a file. The functions fopen , file , file_get_contents , readfile , and even a class named SplFileObject . file reads line by line and puts them...
asked by 04.05.2016 / 14:36
3
answers

How to force a PDF to be displayed in the browser

I have a sequence of PDF files that I can link to normally, but as soon as I click on one of them it downloads, and I need the PDF to be displayed in the browser itself. I've tried using this in my link but it did not work: target="_blank"...
asked by 17.04.2015 / 13:19
1
answer

Prepared statements with MySQLi waits data entry validation?

I was studying here about security in PHP & MySQL, and I had a question: If I'm using prepared statments , is it still necessary to validate data entry? For example, I have a field in the form: <input type='text' name='campo'>...
asked by 24.09.2015 / 09:11
1
answer

Curl cookies expires vs n / a

The question is, in network of the browser console says that cookies do not expire, see the image below: Butwhenyoutake(makearequestofthese)thesecookieswithcurlexpire:  ct0=e3197b1390ba24c4ae827fc6740344fa;Expires=Mon,Oct232017  14:21...
asked by 23.10.2017 / 10:31
2
answers

Queries between tables with Eloquent - Laravel 5

Well, I have the following problem when using Laravel 5 in the table relationship: I have these 4 tables (hypothetical names to illustrate the problem): UsingtheLaravel5templatesI'velistedthemtogether:CompanyTemplatepublicfunctionpessoa(){...
asked by 21.03.2015 / 22:04
4
answers

What is the best way to pass values to the attributes

I'm studying object-oriented programming. I am very fascinated as this new world. But now a question has arisen. I believe you can help me. I'm making a Person class, which has the attributes, age, and gender attributes. But this class wil...
asked by 26.08.2015 / 22:26
1
answer

Can you optimize this code?

Can you optimize this code to make it faster? if (strpos($qt, "blood") !== FALSE){ if (preg_match("/^blood (?<blood>.+)$/", $qt, $match)){ switch ($match['blood']) { case "a+": $result = "A+"; $sndline = "Id...
asked by 13.05.2015 / 02:06
1
answer

Problem with logic when using LEFT JOIN

In my system, there is a system of postings and another system of friendships. Here is the structure of the tables: posts : id | usuario | conteudo | data | hora Friendships : id | usuario1 | usuario2 | status And I'm us...
asked by 21.11.2015 / 16:50