Questions tagged as 'php'

2
answers

Is there a way to adapt an SQL statement when a null field arrives?

Hi, I hope you're ok, is there any way to adapt an SQL statement so that it reacts according to whether a parameter arrives nil or not, something like this: drop table if exists tabla; create table tabla ( id int primary key AUTO_INCREMENT...
asked by 21.08.2018 / 18:07
1
answer

Problem when including class in a PHP

I'm working on PHP and to test my program I'm trying to make the simple lines of code that you see in the image include("model\product.php"); $product = new Product(); $product->setName("Remera"); $product->setDe...
asked by 06.12.2018 / 02:29
2
answers

Warning: mysqli :: query (): Could not fetch mysqli

Show me this error:    "Warning: mysqli :: query (): Could not fetch mysqli in   C: \ xampp \ htdocs \ prac_01 \ html \ php \ table.php on line 28       Fatal error: Uncaught Error: Call to a member function fetch_assoc ()   on null in C: \...
asked by 19.11.2018 / 13:21
2
answers

Show data related to a foreach in Laravel?

I have two tables one called " Events " and another one " Dependences ", a dependency can have several event , that's the relationship between they, what I try to do is show the data of a event , but also show the data of the dependence to w...
asked by 16.09.2018 / 05:21
2
answers

How to discount the days of the weekend

I have the following code where I count the differences of days, but I want to discount the weekends <?php $datetime1 = new DateTime($machine->fechasolicitud); $datetime2 = new DateTime($machine->fecha); $interval = $datetime1->dif...
asked by 12.07.2018 / 16:26
1
answer

How can I replace $ _SESSION with a prepared query?

Well here with a doubt, I currently have querys where I ask for information and at the end a clause WHERE where I ask for that information about the id of the current session, that is only the active user at that moment, and I want to ado...
asked by 01.08.2018 / 04:10
2
answers

Error adding two WHERE conditions in a MySQLi consula?

I want to show data using two conditions WHERE , questions by categories and that these questions are enabled to the public. I do the following: $categoria = "categoria_uno"; $habilitado = "1"; $stmt = $conexion->prepare("SELECT id...
asked by 04.08.2018 / 18:26
2
answers

How can I rename a file before uploading it to the server?

I'm doing a form that processes certain data, I'm using the following code, and I need to know how to rename a selected image, before uploading it to the server. That is, if when you select the image it is called imagen.png , rename it by...
asked by 05.08.2018 / 00:37
2
answers

call a variable in another php without get or post

Thank you very much to the community in advance. good to the matter, I have created a simple dynamic select option that when selecting a client in the next select option your pets come out. Here I charge the clients in the first select o...
asked by 21.10.2016 / 07:11
4
answers

Sort array php kb, mb, gb

I have an array that filled with a query. What I get is the following: array (size=9) '128 GB' => array (size=1) 0 => string '156' (length=3) '16 GB' => array (size=2) 0 => string '106' (length=3) 1...
asked by 09.11.2016 / 20:26