Questions tagged as 'php'

2
answers

Use style within javascript if

Hello, I was doing a test in javascript to see if the value of two inputs were different, if they were I would change the background of an input to red, and tried opening the style tags inside the if and instead of appearing so appearslikethis...
asked by 09.05.2015 / 02:26
3
answers

In PHP does date () get server or user time?

I have a question about date , does it take the time of the server where my site is or the machine that the user is accessing? I'm taking a look at the PHP Manual but I could not figure out which local method it refers to: machine or us...
asked by 19.05.2015 / 23:16
2
answers

Use substr directly in a foreach

My scenario is as follows: foreach ($exibe as $u) { echo "<div class='col-md-3'><div class='thumbnail'> "; echo "<img src='{$u->imagem}' height='120px' class='img-thumbnail'>";...
asked by 28.12.2014 / 22:18
3
answers

Downloads Counter

Could anyone help me do the following: I have a download site where I want to do a download counter for each page and that when clicked, the number of downloads on the page will be updated automatically.     
asked by 17.07.2015 / 07:58
2
answers

Check if a value exists, otherwise print another

I have the following code: <span class="end"><h1><?php echo $this->seo_tags->h1spam; ?></h1><h2><?php echo $this->seo_tags->spam; ?></h2></span> <span class="end"><h3><...
asked by 28.04.2015 / 19:14
3
answers

How to put the last row number of a MySQL table in a variable

I would like to know how to get the last row of a MySQL table, and put this number inside a PHP variable. I tried this way: require_once "../../models/conex.php"; $sql = "SELECT * FROM tabela ORDER BY id DESC LIMIT 1"; $query = $mysqli->...
asked by 19.09.2015 / 08:50
4
answers

Validate, if already exists do not INSERT

I have the following code that registers in the database the id of an article that the user liked. $sql = "INSERT INTO favoritos (id_user, id_oferta) VALUES ('$login_session', '$id')"; if ($conn->query($sql) === TRUE) { echo "New record cr...
asked by 22.08.2015 / 18:47
3
answers

How to remove file including with include according to conditions

I gave a basic search and found nothing. I imagine it should be something simple, and that I may be "looking wrong" ... Then for example: <?php if ($var1 != "qualquercoisa") { include "arquivo1.php"; } elseif ($var2 =...
asked by 28.06.2015 / 19:29
3
answers

Create folder and ID simultaneously using the same id number

I need to create a folder with the same ID number as the user inserts a new article. <?php include './includes/config.php'; setMenu("Notícias"); include './includes/cabecalho.php'; checkLogin(); $erro=""; if ($_POST['salvar']) // notici...
asked by 02.01.2015 / 17:55
2
answers

Array in PHP for JSON

Hello, how are you? I'm getting the values from a table in a database and "transforming" them into JSON. I have the following PHP code: $sql = "SELECT * FROM pessoas"; $query = mysqli_query($mysqli, $sql); $arr = array(); while ($dados =...
asked by 24.12.2014 / 06:25