Questions tagged as 'php7'

3
answers

Delete an element from an array

Is there an easy way to remove an element from a PHP array, such that foreach ($array) does not include that element anymore? I thought that nullifying it would do it, but apparently not.     
asked by 02.04.2017 / 17:30
4
answers

session_start (): Can not start session when headers already sent

I receive this warning that does not allow me to continue:    Warning: session_start (): Can not start session when headers already sent in C: \ xampp \ htdocs \ bancoinfocial \ index.php on line 45       Notice: Undefined variable: _SESSION...
asked by 19.04.2018 / 15:41
1
answer

Fatal error: Can not unset $ this PHP 7.1

I get the following error in PHP: Fatal error: Can not unset $ this that refers to this snippet of code: public function __destruct(){ unset($this); } That line I use to destroy an object, in previous versions of PHP it worked without...
asked by 07.11.2017 / 23:09
5
answers

how can I include a variable inside double quotes

$articulos= $conexion->prepare( 'SELECT SQL_CALC_ROWS * FROM articulos LIMIT $inicio, $postPorPaginas' ); When it's like this inside php, it appears to me as if it were a simple string although I have declared the varible with it...
asked by 23.01.2018 / 20:13
1
answer

debugging of SQL queries in PHP (var_dump and debugDumpParams)

When we are writing our SQL queries, we may need to check how the dynamic data we are sending is behaving, to validate that the result is expected. EXAMPLE I have the following script to bring all the posts of a certain user working 2 ta...
asked by 03.10.2018 / 03:40
1
answer

Problem with form: PHP Uncaught Error: Call to a member function prepare () on string

I'm testing a form and I get that error on line 21 that says: $stat1 = $db->prepare("insert into about values(?,?,?,?,?)"); The code is like this: <?php $host = 'localhost'; $db = 'form'; $user = 'root'; $dbpass = ''; if(isset($_P...
asked by 12.06.2018 / 04:25
4
answers

How to differentiate 2 id within the same query

I have the following quey: $query = "SELECT pedidos.*, users.id, users.nombre, users.email, users.username FROM pedidos INNER JOIN users ON pedidos.usuario=users.idusuario WHERE (email LIKE '%$busqueda%' OR nombre LIKE '%$busqueda%' OR monto...
asked by 15.11.2018 / 16:50
1
answer

Script php, insert data in mysql

I have this PHP script where I make an insert query in a mysql DB, what I do is declare a mysqli object globally and then from a function make the insert, but since the insert function gives me an error, it tells me that recognizes the $ mysqli...
asked by 16.05.2018 / 17:58
1
answer

Make UPDATE to a MYSQL data via PHP with a similar value from the same query

My query in this opportunity is to know if it is possible to make a UPDATE to a database from MySQL where the existing value in the database is only added a letter My query is as follows: $query = "UPDATE pedidos SET status_pedido = '...
asked by 13.11.2018 / 07:02
1
answer

Go through a JSON array and display certain PHP data

A JSON is answering the following: [ { emple_cedula: "7913", emple_nombre: "PEPITO", emple_apellido: "PEREZ", resultado: "60" }, { emple_cedula: "7913", emple_nombre: "PEPITO", emple_apellido: "PEREZ", resultado: "50" }, {...
asked by 20.04.2017 / 18:03