Questions tagged as 'php'

1
answer

How can I create a method that builds different objects based on a variable?

I have several models: class ModeloA { public function __construct(){} } class ModeloB { public function __construct($param1, $param2){} } And a controller to which I inject the models: $controller = new Controller($modelInstan...
asked by 15.04.2018 / 14:48
1
answer

Show image while processing form

Two values are sent from a form: <form action="accion.php" method="post"> <p>Su nombre: <input type="text" name="nombre" /></p> <p>Su edad: <input type="text" name="edad" /></p> <p><input t...
asked by 28.11.2018 / 05:32
1
answer

How to create a folder with the user's name when uploading a file (IMAGE)? PHP

Good on this occasion I want to make the user of my website login with the option of creating a photo album, and I can get the photo that the user uploads through the form with these codes: HTML CODE: <form action="album.php" enc...
asked by 26.11.2018 / 21:02
1
answer

Problem with double php query

This is the code I'm trying and the second query does not make me, in the second while I get a message. I try to save people with an array and their roles in a vector, if you can not do double queries, in what way can it be done? if ($s...
asked by 24.11.2018 / 14:33
1
answer

Return true or false PHP

I realized that the validation did not work and that no matter what data you enter from the maintainer, this code always returns 1. What I'm looking for is that it returns 0 if the sql query did not return any results. if (!$cnn) { die("Co...
asked by 27.11.2018 / 16:51
1
answer

doubt with do while not printing correct numbers

Good I'm doing some tables that print parimpar numbers and 5 in 5 but I already did them in for and while but when I try to do it in do while I throw another result I do not know what is due this is with the for: <!DOCTYPE html> &...
asked by 02.04.2018 / 09:41
2
answers

How to pass data from one view to another with Vue and axios in Laravel

I'm working with Laravel and I have this link in view A <div id="app"> <a href="{{ route('ministries.index') }}">Enlace</a> </div> and I want to click on that link to direct it to view B and show me the results...
asked by 14.02.2018 / 03:37
1
answer

Iterate table in php in Javascript array

Hello, I have the following table that I am calling using a controller Driver $respuesta = GestorOITModels::obtenerViasModel("transporte"); //nombre de la tabla $datos = array($respuesta); echo json_encode($datos); JS file, wher...
asked by 14.02.2018 / 08:36
1
answer

How to create a table in php?

I am trying to create a program that calculates discounts since I have the code but I do not understand how to do it in the form of a table k exit this way try to use tags tr and td but the variables do not detect them. Pr...
asked by 20.02.2018 / 18:36
1
answer

Laravel and the formatting of dates

Gentlemen I am making a query to a table with Eloquent ... and between the fields that I want to consult this one of date, as I do so that in full consultation to bring the date formatted? Ex: $consulta=Ejemplo::select('fecha')->find($id);...
asked by 20.02.2018 / 15:04