php – SQL query where a condition would be to exclude records that are duplicated in a field

Good people I am developing a page where several queries are made to databases, I am using PHP and MySQL, the question is that I cannot conclude a query that has the condition (among others) to obtain the records that have in the field Status = pending , except those that are repeated in the file_number field.
I pass an image with the test database that I am using and the code of the query that in this case tells me that a subquery is repeated more than one row

enter image description here
The query code is as follows

$consulta = "SELECT seguimientos.*, usuarios.nombres, usuarios.apellidos FROM seguimientos, usuarios WHERE seguimientos.usuario_recepcion=(SELECT ID_usuarios FROM usuarios WHERE dni=".$_SESSION('sess_usuario').") AND usuarios.ID_usuarios=seguimientos.usuario_envio AND seguimientos.estado='pendiente' AND NOT(SELECT A.ID_seguimiento FROM seguimientos A, seguimientos B WHERE A.numero_expediente = B.numero_expediente AND A.estado <> B.estado)";

-I clarify that I have to parameterize this query later, I am open to advice by the way

This is what he tells me when I run that query

"Subquery returns more than 1 row"

Thank you!

Horizontal sum – mysql – php

I have a table

            iten a     iten b

today `s date)

date (tomorrow)

I need to add elements a and b to HORIZONTAL. (That is, according to the dates!)

Suggestion?

Thank you

php – Injection of dependencies in Laravel

I am doing a project in Laravel and, after creating the repository classes, service, etc., when injecting the service to the constructor and launching the page, I get an error:

ReflectionException in Container.php line 809:
Class appServicesUserService does not exist

And this is the controller code:

user = $user;
    }

    /**
     * Display a listing of the resource.
     *
     * @return IlluminateHttpResponse
     */
    public function index()
    {
        return view('users.index');
    }
}

In other projects (as for example, in ASP .NET MVC) when you do dependency injection you have tools like Autofac, but in Laravel there is nothing similar.

I have read something like class Container, but I can't find it on any site, so I don't know where to register the service so that when I launch the page I don't get hit

php – GLOB inside WHILE returning the duplicate file

I have one while that brings me some data from database, and I use some of that data to search for some images in a folder rise.

After listing these photos, I associate them with people and, at a certain time, when I add these people, I have the option to select the images that I am going to add.

Only, if I add 5 people and put only 4 images, when I bring this data, the function glob will duplicate some of these identifications to complete the person who did not have their associated photo.

The "functional" form with duplication of identifications is like this;

while ($result = $conn->fetch(PDO::FETCH_ASSOC)) {

        $getName = $result('candidate') . '*';
        $mountName = $id . '=' . $getName;

        foreach (glob("admin/core/class/uploads/" . $mountName) as $file) {
                $return = $file;
        }

        $tplTemp .= '
            
'; }

That way, I bring the results normallyinsert image description here

But as you can see, the images doubled because when you added the 5 people, you only uploaded 4 photos. The system is supposed to work this way (a person is not required to have a photo), but when I don't have a photo, I wanted to put a standard image, which made me think of this code:

while ($result = $conn->fetch(PDO::FETCH_ASSOC)) {
$getName = $result('candidate') . '*';
$listPath = dir("admin/core/class/uploads/");

$amountName = $id . '=' . $getName;

foreach (glob("admin/core/class/uploads/" . $amountName) as $file) {

    //$return = $file;

    if ($file == null) {
        $return = 'admin/core/class/uploads/semfoto.png';
    } else {
        $return = $file;
    }
}

$tplTemp .= '
'; }

Keep returning the duplicate ID, and it even makes sense, because I'm asking if $file it is empty. I'm a little lost in how I can achieve my result, any explanation?

php: how do I publish only one page in production after making changes to the staging?

Is it possible to boost only one view to production? For example. I made a change in sight A a while ago in the staging and has only been sitting in the staging.

Later, I am asked to make a change in view B. The problem is: I do not want the changes in view A to be still in production. I just want the changes in view B to be in production. it's possible? (I'm using GoDaddy.com, if that matters.)

I can't find anything online that belongs to my question. I imagine something like this definitely exists.

Thanks for taking the time to read: D

php – How to insert all check boxes in the bank in a support table?

I have the following code that will generate a form:


Voltar

And the PHP output to insert into the bank is:

setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            $sql = "INSERT INTO reuniao (reuniao_id, reuniao_data, reuniao_hora, reuniao_pauta, status_status_id) VALUES(?,?,?,?,'1')";
            $q = $pdo->prepare($sql);
            $q->execute(array($reuniao_id,$data,$hora,$pauta));
            Banco::desconectar();
            header("Location: index.php");
        }
    }
?>

My question:

I have a table in mysql that should store the values ​​of "meeting ID" and "UF_ID", but how will I generate a loop so that all selected states are created in this table with the meeting ID that the user is registering ? I tried to do it manually, but the possibilities are many, can anyone help me?

javascript – Why is the result not shown in PHP?

The problem is that I want the href attribute to be assigned to a variable in javascript every time the click event is generated, but then I want it to be passed to php in order to make a query that registers in the database, I have the following code, when I do this locally it works for me but when I do it on a server, it doesn't work, why will it be?

main file:


    
    
    

secondary file (res.php – in the same directory as the main file)


php: emails from amazon ec2 server are not sent stored in mailq

I host my website on the Amazon ec2 Ubuntu 18.08 instance,
I send the contact form details to my email id using the PHP mail feature
Emails are stored in mailq I cannot receive notifications from the contact form
What I need to install.

beginner: my code is trying to extract data and present it on a web page from 2 databases using php / pg_connect and postgresql

My code is trying to connect and use 2 different postgresql dbs (postgres and postgres1) on the same computer (localhost) and the same php file.

pg_connect works for the default postgres db – no problem.

How can I use pg_connect to connect to another instance called postgres1 from the same php file?

php code:

$dyn_connect1 = pg_connect("host=localhost port=5432 user=postgres password=postgres dbname=postgres");

$dyn_connect2 = pg_connect("host=localhost port=5432 user=postgres password=postgres dbname=postgres1");

if (!$dyn_connect1) {
    echo "did not connect to postgres";
}
else {
    echo "connected to postgres";
}

if (!$dyn_connect2) {
    echo "did not connect to postgres1";
}
else {
    echo "connected to postgres1";
}

php: error loading files

I intend to upload files, where I insert the name of the file into the database and the file in a folder on the server.

I am trying this way:

HTML:

Add Arquivo...

JS:

function inserir_anexos()
{  
    var dadosajax = {
        'CodigoUtente' : $("#CodigoUtente6").val(),
        'arquivo' : $("#arquivo").val()
    };
    $.ajax({
        url: './recebe_upload',
        type: 'POST',
        cache: false,
        data: dadosajax,
        error: function(){
            Swal.fire("Erro!", "Tente novamente. Caso persista o erro, contatar Administrador!", "error");
        },
        success: function(result)
        { 
            $('.form5')(0).reset();
            Swal.fire('Boa!', 'Gravado com sucesso!', 'success');
        }
    });
}

PHP has this way:

$CodigoUtente = mysqli_real_escape_string($conn, $_POST("CodigoUtente"));
$Colaborador = $_SESSION('usuarioId');
$pathToSave = "/var/www/html/wp-content/themes/sparkling/alimentacao";

if (!file_exists($pathToSave)) {
    mkdir("$pathToSave", 0777);
}

   if ($_POST('arquivo')) { 
        $dir = $pathToSave; 
        $tmpName = $_POST('arquivo')('tmp_name'); 

        $name = $_POST('arquivo')('name');
        preg_match_all('/.(a-zA-Z0-9)+/', $name, $extensao);
        if (!in_array(strtolower(current(end($extensao))), array('.txt', '.pdf', '.doc', '.xls', '.xlms'))) {
            echo('Permitido apenas arquivos doc,xls,pdf e txt.');

            die;
        }

       if (move_uploaded_file($tmpName, $dir.$name)) { 
            echo('Arquivo adicionado com sucesso.');
        } else {
            echo('Erro ao adicionar arquivo.');
        }   


           $query = 'INSERT INTO raddb.UploadArquivo(CodigoUtente, arquivo, Colaborador)  
           VALUES ( ?, ?, ?)';
           $stmt = $conn->prepare( $query );
           $stmt->bind_param("sss", $CodigoUtente, $name, $Colaborador);
           $stmt->execute();    
    }  

But when I record, I receive this message in the console:

Only doc, xls, pdf and txt files are allowed.

And I am inserting a pdsf as shown in the image:

insert image description here

And in the browser console the file name is also sent, as shown in the image:

insert image description here

But neither insert it into the database nor save the pdf file in the indicated folder.

Can you help