Questions tagged as 'php'

1
answer

How to use more than two types in function parameters?

Suppose the following function in PHP: function parse (string $text, array $callback) { # ... } In theory, the parameter $callback must be an array , but can also be accepted as string . How do I accept both arrays and str...
asked by 29.12.2017 / 22:07
2
answers

UPDATE PHP with JavaScript

I'm trying to perform UPDATE, but it gives the following error:    Notice: Undefined index: id in C: \ wamp \ www \ SitePHP \ base \ updateFuncionario.php on line 4. Follow my code function function atualizar(id){ if(confirm("Deseja...
asked by 23.11.2017 / 20:21
3
answers

Convert seconds in days

I have a very simple question: How to convert seconds into days? tried using: <?php echo date('d', $userstats['OnlineTime']); ?> but goes only up to 31 days. <?php $userstats_a = mysql_query("SELECT * FROM user_stats INNER JOI...
asked by 11.11.2017 / 20:39
1
answer

Error Notice: Trying to get property of non-object when getting the title of the page

I have a code that should take the title of the page example "Facebook - enter or sign up" but that is giving error in this line $title = $dom->getElementsByTagName('title')->item('0')->nodeValue; this is the code: function websit...
asked by 23.03.2016 / 16:36
2
answers

PDF decode base64

I'm setting up a job where I need to download the file in pdf , however this file is saved in the database it is in base64 format. My idea is to do when the comrade clicks on the line he does the download , of the file....
asked by 08.03.2016 / 18:42
1
answer

How do I set cookies and set expiration time?

I have a div where I search only logged in users, in it I'm displaying the users but every update is inserted new records, gave me the hint of using cookise more never worked with it. the following code is giving the error Warning: Can not modif...
asked by 10.02.2016 / 01:07
3
answers

How do I make icone font awesome change the color to indicate the current page? [closed]

Use awesome font as menu. The initial icon color is yellow. How do I make the icon remain white when it is on the current page? I have tried using css, but without success. <div class="centralizar"> <?php $paginaCorrente = basename($_...
asked by 19.06.2017 / 14:36
2
answers

Difference between the fetch and setFetchMode methods of the PDO

I've understood the difference between fetch and fetchAll, but now, what's the difference between these and setFetchMode? It looks like it's the same thing ... (at the time of riding at least). I can do both like this: fetch(PDO::FETCH_ASSO...
asked by 16.08.2017 / 01:08
1
answer

How to make require_once from multiple locations on one line only?

For example, I'm doing this: require_once 'Testeum.php'; require_once 'Testedois.php'; require_once 'Testetres.php'; Can you do this with a single require_once? With attribute I can put comma: private $testeum, $testedois, $testetres;...
asked by 16.07.2017 / 19:47
3
answers

Method in PHP have line limits?

   The method size is 22 rows. (20 Allowed) NetBeans gives me this "warning", why? Is it a PHP rule? What's best: A great method with all the code it needs. Splitting this code into smaller methods Is there an adequate number of r...
asked by 03.07.2017 / 22:55