Questions tagged as 'php'

3
answers

Image Upload Error in PHP

I'm getting the error below when I upload an image, but I'm not able to identify what I have to fix. Warning: move_uploaded_file(/uploads/1432585475.png) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/...
asked by 25.05.2015 / 22:31
3
answers

SELECT in two tables, with comma-separated IDs

Hello! How to do a SELECT that returns the data of the first table, whose "id" are separated by commas in the second table? Example: tbl_cores id | cor 1 | azul 2 | verde 3 | amarelo 4 | vermelho tbl_mesa id | core...
asked by 13.06.2016 / 14:07
2
answers

Doubt regarding switch case if

Is this right or wrong? It only works for $estado=1; : <?php // inicia sessão session_start(); // ligação à base de dados include ('config.php'); // captura valores da compra $estado = $_REQUEST['estado_compra']; $id = $_REQUEST['i...
asked by 30.05.2015 / 21:01
2
answers

Get keys from an array

I am using PDO for mysql query, and I would like to get the keys from an array, tried several methods and did not succeed, ex: $arr_cars['id'] an error occurred class Cars extends DB{ static function getCars(){ $select =...
asked by 14.07.2016 / 07:30
3
answers

One process at a time PHP

I would like to know if there is a way to create a queue of processes. For example, whenever I run the processar.php file, if it is already running, it will wait to run after the other is finished. Being run only when "free";     
asked by 19.07.2016 / 19:55
3
answers

php session - destroy all sessions and keep only one active

Hello, I need to destroy all sessions when logging out of a system, except for just one ... would anyone know how to implement this with php? For example: Let's say I have 5 active sessions when the user is logged in: $session1 = $_...
asked by 10.08.2018 / 19:07
2
answers

Delete HTML Element after a few seconds

Next, I have a registration script, which when registering a user successfully, makes the following command to display a message on the screen: echo "<p class='msg-success'> Usuário Cadastrado com sucesso!</p>"; My question is:...
asked by 21.08.2016 / 01:38
3
answers

Using regular expressions with square brackets

Greetings, I have to remove any occurrence of text between brackets. For example: Eg: [Text in brackets] Text outside brackets. The output would be: "Text outside brackets"; I tried to use the following Regex: $string = "[Texto entre col...
asked by 15.08.2018 / 14:54
1
answer

Ternary operator in PHP gives unexpected result

I recently ran a test and there was a question asking what the return of the expression: $var = true ? '1' : false ? '2' : '3' I replied that the result would be '1', but the correct result is '2'. If the code is written: $var = true ? '1...
asked by 12.11.2018 / 00:06
1
answer

New row in the table every 3 columns

I have a table that has to have 3 columns per row. The data from the 3 columns I get from the bank. My problem is that when I display 3 columns, I want the next results to appear on the bottom lines, ie display 3 at 3, but I'm not getting it, be...
asked by 05.05.2015 / 02:04