Questions tagged as 'php'

1
answer

Error 'use' (T_USE) when using autoload

I have the following folder and file structure: -api -v1 -libs -Slim -Facebook -autoload.php -index.php -login.php Inside the "index.php" I include the "login.php" include: require_once 'login.php'; In the "login....
asked by 17.02.2015 / 19:54
3
answers

How to solve foreign key error 150 in migration with laravel?

I'm having trouble creating the foreign key in migration. I'm working with PHP, LARAVEL 5.3 and MYSQL. You are giving me the following error: Below is my code: Table Migration of the categs class CreateCategsTable extends Migr...
asked by 28.07.2017 / 12:49
1
answer

How to treat ids with php?

while ($row = mysqli_fetch_array($result)) { echo "<li class='list-inline-item'><a href='news.php?id=" .$row['id']. "'>". $row['titulo'] ."</a></li>"; echo "<br>"; } I...
asked by 21.07.2017 / 01:57
1
answer

Primary key return of an INSERT

I have tabela_x , where the first field ( campo1 ) is primary key and autoincrement . I make a simple INSERT : $ins = " INSERT INTO tabela_x ('campo2','campo3','campo4') VALUES ($c2, $c3, $c4) "; $con -> qu...
asked by 09.04.2018 / 14:16
2
answers

Color of the record, referring to quantity

I have a table with multiple records , and these have a " data " field. I generate a list of these records, I make the difference of days by comparing the " date " with the " current date ". Example: $dias = $data_hoje - $data_registro;...
asked by 04.05.2018 / 21:40
1
answer

PHPMailer function differences

In the documentation does not leave much explained this (I think), then, what would be the difference of: I'm using the $mail variable for the example. $mail->Username $mail->setFrom $mail->addAddress $mail->addR...
asked by 13.04.2018 / 13:23
1
answer

How to have the isset function using $ queryString in php

I have a code in php that has the function to get the parameter ?capa= with parse_str <?php $url = parse_url($_SERVER["HTTP_REFERER"]); parse_str($url["query"],$queryString);?> This is his code: <?php echo $q...
asked by 23.04.2018 / 08:52
1
answer

How to print directly without opening the browser dialog?

I am developing a web system where I need to print a label and a non-tax receipt after submitting a certain form. To perform this action, I have two printers: Non-Fiscal Matrix Printer MP-20 MI - For non-tax coupon; Zebra Thermal Printer T...
asked by 19.09.2016 / 22:49
2
answers

Generate random number for an array

I have a foreach that fetches the data from one table and makes a insert in another table. I need to count the number of foreach registers, and then generate a random sequence, and feed a insert field. See the code...
asked by 18.10.2016 / 14:24
2
answers

How to create XML tags from the column names of a mysql database?

How do I create XML tags with the column names of a table from a myslq query? In the code I made I just get the values from each cell in the table, but what I wanted was to automatically create the tags according to each column. My Curren...
asked by 13.10.2016 / 17:01